# Bulk-Save Shared Terabox Links with a Selenium Scraper and GUI

> A scraper collects titles and share links into a manifest, then a GUI automation logs in manually and saves every link to a Terabox folder you choose - for content you are authorised to copy.

URL: https://thuyavan.netlify.app/scripts/terabox-link-automation
Updated: 2026-10-07

## Problem
Resource sites list hundreds of Download buttons that lead to Terabox shared links, and Terabox has no bulk-save. Saving 100 files by hand takes hours.

## Solution
Stage 1 scrapes titles and links into a manifest; stage 2 is a GUI automation engine that, after a manual login, visits each link and saves it into a target folder.

## Result
Hours of repetitive clicking reduced to a single run with real-time progress logging.

## Input
- Target resource website (stage 1)
- terabox_links.txt – one URL per line (stage 2)

## Output
- Every shared link saved into your chosen Terabox folder

## Optional output
- Human-readable "{Title} - {URL}" list
- Live GUI log of successes, timeouts and failures

## System flow
url_finder_2.py (Selenium · pair title ↔ link) -> terabox_links.txt (Clean URL manifest) -> tera_link_saver_4.py (Tkinter GUI control panel) -> Manual login (Bypass 2FA / captcha) -> Save loop (XPath clicks · verify · log)

## How it works
- **Dynamic loading:** Waits for JavaScript so links missing from initial HTML are captured.
- **Heuristic pairing:** Regex finds numbered titles and pairs each with the next Download button.
- **Manual-to-auto handover:** You log in by hand, then the script takes over – no captcha fighting.
- **Absolute XPaths:** Precisely target Save, folder, Yes and the success message.
- **State verification:** Checks the link identifier (surl) so dead or redirected links do not crash the run.
- **Error resilience:** Falls back to JavaScript clicks when overlays intercept a normal click.

## Configuration
- `Links file`: terabox_links.txt – only lines starting with http are processed.
- `Credentials file`: Optional credentials.txt (email,password); manual login is recommended.
- `target_folder_xpath`: Points at the destination folder in the Save dialog (tuned to "TestUpload").

## How to run
Step 1 – extract links:

    python url_finder_2.py
Step 2 – open the control panel:

    python tera_link_saver_4.py
Step 3:

    # Start Browser → log in manually → Start Saving

## Impact
- Replaces hours of manual clicking with one execution.
- Anti-bot friendly through the manual login phase.
- Live progress such as "Successfully saved link 5/100".

## FAQ
**Can Terabox save many shared links at once?**
Not natively. These scripts automate the repetitive clicks: open each link, press Save, pick the folder and confirm.

**Why do I log in manually?**
Manual login avoids captchas and two-factor prompts, then the script takes over for the repetitive part.

**Is this allowed?**
Use it only for content you own or may copy, and follow Terabox and the source site's terms of service.

