IMDB info + .torrent from magnet (fixed 1337x + GM API)

Show IMDB info on torrent sites and add .torrent download links for magnets

作者
quantavil
日安装量
0
总安装量
3
评分
0 0 0
版本
4.1
创建于
2025-10-04
更新于
2025-10-04
大小
24.5 KB
许可证
MIT
适用于

# IMDB Info + Torrent Script Project

This project contains a userscript that fetches IMDB information for movie titles on torrent sites and tests parsing logic for movie/series titles.

# NOTE : USE YOUR OWN API KEY : Uses the [OMDb API](https://www.omdbapi.com/) to fetch movie data (plot, director, rating, etc.).
## Files

### app.js
A userscript compatible with Tampermonkey/Greasemonkey that:
- Scrapes movie titles from torrent site pages
- Fetches IMDB API data for ratings, plot, cast, etc.
- Displays hover popups with movie information
- Adds torrent download links (magnet to .torrent conversion)
- Works on various torrent sites (The Pirate Bay, 1337x, RARBG, etc.)

**Requirements:**
- OMDb API key (replace `OMDB_API_KEY` in the script)
- Tampermonkey or Greasemonkey browser extension

### test_parsing.js
A Node.js script that tests the movie/series title parsing logic from the userscript.

**Purpose:**
- Reads HTML data from `todo.txt`
- Extracts movie titles from torrent site HTML structure
- Parses titles to determine movie/series format
- Counts successful parsings vs failures
- Outputs results to `result.txt` with detailed log

**Usage:**
```bash
node test_parsing.js
```

**Output:**
- Console: Summary counts (Total, Movies, Series, Unknown, Pass)
- result.txt: Detailed summary + log of each parsed title

### todo.txt
Sample HTML data containing 100 movie titles scraped from a torrent site.
- Contains `` elements with movie names
- Used as input for the parsing test
- All entries are valid movie titles with years

### result.txt
Output file generated by running `test_parsing.js`
- Contains parsing test results
- Shows how many titles passed/failed
- Includes detailed log of title -> parsed title (year) mappings

## Testing Results

Latest test run on `todo.txt`:
- **Total titles:** 100
- **Movies:** 100 (100%)
- **Series:** 0 (0%)
- **Unknown:** 0 (0%)
- **Pass rate:** 100%

All movie titles in the sample data were successfully parsed, with clean title names and valid years extracted.

## Script Logic

The parsing logic handles:
- Extracting title from anchor tags with `data-movie-hash` attribute
- Removing quality tags (1080p, x265, WEBRip, etc.)
- Detecting years (19XX/20XX) for movies
- Detecting SXXEXX or XxXX patterns for series (though none in sample data)
- Cleaning punctuation and extra spaces

## Installation

1. Install Tampermonkey extension in your browser
2. Replace `OMDB_API_KEY` in `app.js` with a valid key from https://www.omdbapi.com/apikey.aspx
3. Load `app.js` as a userscript in Tampermonkey
4. Visit a supported torrent site - the script will automatically activate

## Dependencies

- For `app.js`: Tampermonkey/Greasemonkey
- For `test_parsing.js`: Node.js with `fs` module (built-in)

## API Keys

- **OMDB API:** Free key required for movie data fetching (1000 requests/day)
- No API key needed for title parsing/testing

## Supported Sites

The userscript works on:
- thepiratebay.org
- 1337x.to
- rarbg.to
- zooqle.com
- torlock.com
- eztv.io
- demonoid.is
- toorgle.com
- kickass.to
- kat.cr
- Most sites using magnet links

## License

This project is for educational purposes only. Use at your own risk.