How tomorrow505/auto_feed_js works
Project type and purpose
• This is neither a traditional multi-tier “backend + frontend + database” system nor a server-hosted web app. It’s a Tampermonkey/Greasemonkey userscript written in JavaScript (auto_feed.user.js) that runs entirely in the browser.
• Purpose: “one-click repost” (auto-filling forms, fetching metadata, handling images, torrent clean-up) across 100+ PT tracker sites and external sources (IMDb, Douban, public image hosts).
File structure
• Top-level script: auto_feed.user.js – core logic, site detection, HTTP requests, DOM injection & form filling.
• Helper script: iTS Upload Helper.js – utilities for torrent cleaning / uploading.
• Static HTMLs (bdc_faq.html, bluebird_rules.html, etc.) – offline documentation of per-site rules and FAQ, not part of runtime.
• temple_search_urls – likely a data file mapping site names to search endpoints.
• README.md & license.
README
• Confirms it’s a browser userscript with features like:
• Scraping the source page (magnet, title, description)
• Fetching IMDb ID → retrieving Douban metadata
• Uploading images to a public image bed to avoid hotlinking
• Cleaning torrent files automatically
• Filling target tracker forms & submitting
• Optional one-click multi-site repost, duplication check, custom site ordering, internationalization.
a. Main components:
1) User & Browser Environment (Chrome/Firefox) with the Userscript Manager (Tampermonkey)
2) auto_feed.user.js core module
3) iTS Upload Helper submodule
4) temple_search_urls data module
5) Source PT Tracker sites (Site A, Site B, …)
6) Destination PT Tracker sites (could be same as source or multiple)
7) External Metadata Services (IMDb, Douban APIs or web pages)
8) Public Image Hosting Service (for anti-hotlinking)
9) (Optional) Local storage/cache in the browser (for speed)
b. Relationships & data flows:
• User clicks “Repost” button injected into a source site page → auto_feed.user.js kicks in.
• Script scrapes page DOM for torrent/magnet and descriptive fields.
• Script calls external IMDb/Douban endpoints via GM_xmlhttpRequest (cross-domain).
• Script processes image tags, re-uploads to public CDN via its upload API.
• With all data assembled, script auto-fills the target site’s form fields and triggers submission.
• iTS Upload Helper may intercept and clean the .torrent before it’s attached.
• Data/config (temple_search_urls) guides which endpoints to scrape or submit to.
c. Architectural patterns & design principles
• Modular plugin pattern: core script + helper modules + data file
• Event-driven UI injection: detect page URL → initialize injection → bind UI controls
• Asynchronous HTTP pipeline: fetch → transform → fill → submit
• Single-page, client-side only—no server components
d. Key technologies & libraries
• JavaScript (ES6+)
• Greasemonkey/Tampermonkey APIs (GM_xmlhttpRequest, GM_setValue, GM_getValue)
• HTML templates for per-site UI injection
• temple_search_urls data structure (JSON or JS object)
• (Possibly) Promise libraries (e.g., bluebird if included)