How ahmed-abdelwahed1/x-unbookmarker works
Project type + purpose (what you’re diagramming)
This repo is a Chrome Extension (Manifest-based) that runs entirely in the user’s browser to automate bulk deletion of X/Twitter bookmarks. There is no backend service and no external data store; the “system” is essentially:
• Extension UI (popup) for user control + progress display
• Content script that executes automation on x.com/i/bookmarks
• Chrome Extension runtime / messaging connecting popup ↔ content script
• Target web app DOM (X/Twitter Bookmarks page) as the “environment” the automation manipulates
• Chrome Extension boundary
• Web page boundary (x.com)
• Chrome APIs boundary (tabs, scripting, runtime messaging)
File structure analysis (map files → components)
From the tree:
• manifest.json
• Defines extension entry points, permissions, host matches, and which scripts run where.
• src/popup.html, src/popup.js, src/popup.css
• Likely contains: Start/Stop action, delay slider, progress/remaining count.
• src/content.js
• The automation engine injected into X pages (or specifically bookmarks page).
• Implements: DOM scanning for bookmarked items, click “remove bookmark”, delay logic, scrolling to load more, retry/error handling, progress reporting.
• assets/
• package.json
• Build/release tooling (even if no bundler is present).
• .github/workflows/release.yml, update-version.js
• Release automation + version bumping. Include in a separate “CI/CD & packaging” view if desired.
Key architectural hint: There is no background.js / service worker shown. That suggests a simpler architecture: popup directly communicates with content script (often via chrome.tabs.sendMessage) and the content script does the work.
• Bulk remove bookmarks
• Custom delay (rate-limit avoidance)
• Real-time progress tracking
• Smart scrolling (load more as you clear)
• Error handling with retry
• Local processing (explicitly show *no external servers*)
These behaviors should appear as labeled interactions/data flows between popup ↔ content script ↔ X DOM.
Popup UI
• popup.html
• popup.js
• popup.css
• Responsibilities: user initiates cleaning, sets delay, shows progress/errors.
Content Script: Bookmark Cleaner
• content.js
• Responsibilities:
• Detect bookmark items in DOM
• Click/unbookmark actions
• Delay/rate-limit pacing
• Retry on failure
• Scroll/load more content
• Emit progress events
Extension Manifest
• manifest.json
• Responsibility: wiring (what runs where, permissions, host access)
Container 2: “Chrome / Extension Runtime APIs”
chrome.runtime messaging
• Popup ↔ Content Script communications (commands + progress updates)
chrome.tabs / scripting (if used)
• Selecting active tab, ensuring content script is present, etc.
Container 3: “X (Twitter) Website”
Bookmarks Page UI / DOM
• https://x.com/i/bookmarks
• Includes infinite scroll feed + bookmark buttons.
X Network/API
• Not called directly by the extension, but indirectly by the page when DOM clicks happen.
User → Popup UI
• “Click Start Cleaning”
• “Adjust delay slider”
Popup UI → chrome.runtime messaging → Content Script
• Message: START with config {delayMs}
• Message: STOP (if supported)
• Message: SET_DELAY (if live adjustment is supported)
Content Script → X Bookmarks DOM
• “Query DOM for bookmarked tweets”
• “Click ‘remove bookmark’ button”
• “Scroll to load more”
• “Detect end-of-list / no more bookmarks”
Content Script → Popup UI (via messaging)
• Progress updates: {removedCount, remainingEstimate, status}
• Errors/retries: {errorType, retryCount}
• Completion: {done: true}
• “Unbookmark API requests triggered by DOM click”
• “Fetch next page of bookmarks triggered by scroll”
Architectural patterns used
• Browser extension “UI + injected automation” pattern
• Event/message-driven coordination (popup commands; content emits progress)
• DOM automation / RPA-like behavior (operates by interacting with the web UI)
• Client-only / privacy-by-design (explicit “no external servers”)
Technologies that matter
• “Chrome Extension (Manifest V3 or V2—confirm from manifest.json)”
• “Content Script (JavaScript injected into x.com)”
• “Popup (HTML/CSS/JS)”
• “Chrome Runtime Messaging API”
• “X.com Bookmarks page DOM”
Before finalizing, quickly open manifest.json and verify:
• Manifest version (MV3 vs MV2)
• content_scripts.matches scope (x.com only? bookmarks path?)
• Permissions (tabs, scripting, activeTab, storage, etc.)
• Whether there is a background service worker (not shown in tree, but manifest confirms)