How brandonyuyu/douyin-archiver works
Douyin Liked / Favorites Archiver is a browser extension that archives the signed-in user’s liked and favorited videos. The main workflow runs a page-side response hook while the content script scrolls virtualized lists, validates and normalizes captured data, then sends records to the service worker for deduplicated persistent storage. Users can monitor runs, export JSON/CSV, and import or clear archives. The README and source index support the main flow; some internal wiring is documented rather than visible in the sampled excerpts.
Main entry points: content.js Capture controller · popup.js Run controls and status · manage.js Archive management · service-worker.js Background service worker
Components 20
Capture and scrolling
- Network response hook
extension/content/hook.js - Capture controller
extension/content/content.js - API response parser
extension/lib/capture.js - Record normalization
extension/lib/normalize.js - DOM fallback harvester
extension/lib/domHarvest.js - Scroll and run loop
extension/lib/scroll.js - Interruption detection
extension/lib/interruptions.js - Douyin site rules
extension/lib/targets.js
Archive and settings
- Background service worker
extension/background/service-worker.js - Persistent archive
extension/lib/store.js - Record merge and dedup
extension/lib/dedup.js - Run settings
extension/lib/settings.js - Stop and pause rules
extension/lib/stopRules.js
User interface
- Run controls and status
extension/popup/popup.js - Archive management
extension/pages/manage.js
Import and export
- JSON archive format
extension/lib/exchange.js - CSV formatter
extension/lib/csv.js - File download
extension/lib/download.js
Other components
- Archive user
- Douyin page
Connections 28
- Archive user → Run controls and status: starts run
README.md - Run controls and status → Capture controller: controls run
README.md - Capture controller → Scroll and run loop: drives scrolling
- Douyin page → Network response hook: serves list responses
README.md - Network response hook → Capture controller: forwards response copy
README.md - Capture controller → API response parser: validates responses
- API response parser → Record normalization: normalizes items
extension/lib/capture.js - API response parser → Douyin site rules: uses site rules
extension/lib/capture.js - Capture controller → DOM fallback harvester: harvests fallback
README.md - DOM fallback harvester → Record normalization: normalizes items
extension/lib/domHarvest.js - DOM fallback harvester → Douyin site rules: uses selectors
extension/lib/domHarvest.js - Scroll and run loop → Stop and pause rules: evaluates run state
extension/lib/scroll.js - Scroll and run loop → Run settings: uses run settings
extension/lib/scroll.js - Capture controller → Interruption detection: detects interruptions
- Capture controller → Background service worker: sends captured records
README.md - Background service worker → Persistent archive: persists archive
extension/background/service-worker.js - Persistent archive → Record merge and dedup: merges records
extension/lib/store.js - Background service worker → Run settings: normalizes settings
extension/background/service-worker.js - Run controls and status → Background service worker: requests state and records
extension/popup/popup.js - Archive management → Background service worker: requests archive actions
extension/pages/manage.js - Archive management → JSON archive format: parses imports
extension/pages/manage.js - JSON archive format → Record normalization: sanitizes imported records
extension/lib/exchange.js - Run controls and status → JSON archive format: builds JSON export
extension/popup/popup.js - Run controls and status → CSV formatter: formats CSV export
extension/popup/popup.js - Archive management → CSV formatter: formats CSV export
extension/pages/manage.js - Run controls and status → File download: downloads exports
extension/popup/popup.js - Archive management → File download: downloads exports
extension/pages/manage.js - Archive user → Archive management: imports or clears
README.md