How 0xissam/aliexpress-links-scraper works
Project Type and Purpose
• Type: Chrome browser extension (client-side tool).
• Purpose: Provide a small popup UI that, on user request, scrapes product links from an active AliExpress page and copies them to the clipboard.
File Structure
• Top‐level directory “Aliexpress Links Scraper” holds:
• manifest.json – metadata, permissions, entry points
• popup.html, popup.css – UI layer
• popup.js – main logic
• No backend or external servers—everything runs in the user’s browser.
Pull Insights from README
• Defines three link‐count options (50, 100, 500).
Main Components & Their Roles
A. manifest.json
• User interaction trigger.
C. Popup UI (popup.html + popup.css)
• Renders radio buttons and “Copy” button.
D. Popup Script (popup.js)
• Listens for UI events.
• Invokes chrome.tabs.executeScript or chrome.scripting.executeScript to inject or run scraping code in the context of the active tab.
• Receives scraped links (via callback or message).
• Uses Clipboard API or chrome.clipboard to copy results.
• Sends a success notification back to the UI.
E. Content‐injected Script (may be inline in popup.js or separate)
• Runs in the page’s DOM context.
• Queries document for product link elements.
• Extracts hrefs up to the user‐selected count.
• Returns array of links to popup.js.
F. Active Tab / AliExpress Web Page
• The runtime environment whose DOM is scraped.
G. Clipboard (OS clipboard service)
• Final data sink for links.
Data Flow & Interactions
2. popup.js attaches event handlers to radio buttons + “Copy”.
3. On “Copy” click → popup.js calls chrome.tabs.executeScript / chrome.scripting.executeScript in the active tab.
4. Content script runs, scrapes DOM, and returns results to popup.js.
5. popup.js writes links to the clipboard.
6. popup.js updates the popup UI with a success message.
Architectural Patterns & Principles
• Single-page popup UI for minimal surface area.
• Separation of concerns: manifest → config, popup.html/css → view, popup.js → controller/logic, injected script → model (DOM scraping).
• Message‐passing via Chrome’s extension API to bridge popup and page contexts.
• No persistent storage or backend—fully client-side.