npm package: @speed_of/movietorrent-scraper
Description: movietorrent  scraper for extracting movie news from all pages.
Author: Cengiz Karaaslan
Latest version: 2.0.4

# movietorrent-scraper

**@speed_of/movietorrent-scraper** — YTS.mx, 1377x ve TorrentDownloads sitelerinden film ve torrent bilgisi çeken Node.js kütüphanesi. Harici bağımlılık gerektirmez; Node.js built-in `https`/`http` modüllerini kullanır.

## Kurulum

```sh
npm install @speed_of/movietorrent-scraper
```

veya kaynak koddan:

```sh
git clone https://github.com/cengizkaraaslan/movienews-scraper.git
cd movienews-scraper
npm run build
```

---

## Kullanım

### YTS Movie Scraper

YTS.mx üzerinden film arama ve torrent bilgisi çekme.

```js
const { ytsMovieScraper } = require('@speed_of/movietorrent-scraper');

// Film arama
const movies = await ytsMovieScraper.search('Inception', '2010');
// year parametresi: tek yıl "2010", aralık "2010-2020" veya tümü "0"

console.log(movies);
// [
//   {
//     id: 'inception-2010',
//     title: 'Inception',
//     year: '2010',
//     rating: '8.8 / 10',
//     genre: 'Action',
//     imageurl: 'https://img.yts.mx/...',
//     url: 'https://yts.mx/movies/inception-2010'
//   }, ...
// ]

// Torrent listesi alma
const torrents = await ytsMovieScraper.getTorrents('inception-2010');

console.log(torrents);
// [
//   {
//     link: 'https://yts.mx/torrent/download/...',
//     description: 'Inception 1080p BluRay x264',
//     size: '2.15 GB',
//     resolution: '1920x800',
//     language: 'English',
//     fps: '23.976 FPS',
//     duration: '2h 28min',
//     seeds: '1234',
//     subtitlesUrl: 'https://yifysubtitles.ch/...',
//     quality: '1080p BluRay x264'
//   }, ...
// ]
```

**`search(query, year)`**
| Parametre | Tür    | Açıklama                                      |
|-----------|--------|-----------------------------------------------|
| query     | string | Aranacak film adı                             |
| year      | string | Yıl filtresi: `"2010"`, `"2010-2020"`, `"0"` |

**`getTorrents(movieId)`**
| Parametre | Tür    | Açıklama                                      |
|-----------|--------|-----------------------------------------------|
| movieId   | string | Film slug'ı (örn. `"inception-2010"`)         |

---

### 1377x Movie Scraper

1377x.to üzerinden film arama ve magnet link çekme.

```js
const { xtoMovieScraper } = require('@speed_of/movietorrent-scraper');

// Film arama (query, year, page)
const movies = await xtoMovieScraper.search('Interstellar', '2014', 1);

console.log(movies);
// [
//   {
//     id: '1234567',
//     title: 'Interstellar 2014 1080p BluRay x264',
//     year: '2014',
//     rating: '423',       // seeds sayısı
//     quality: '1080p BluRay x264',
//     imageurl: '',
//     url: 'https://www.1377x.to/torrent/1234567/...'
//   }, ...
// ]

// Magnet & detay alma
const info = await xtoMovieScraper.getTorrents('https://www.1377x.to/torrent/1234567/...');

console.log(info);
// {
//   magnetLink: 'magnet:?xt=urn:btih:...',
//   imdbId: 'tt0816692',
//   language: 'English',
//   size: '2.18 GB',
//   seeders: 423
// }
```

**`search(query, year, page)`**
| Parametre | Tür    | Açıklama               |
|-----------|--------|------------------------|
| query     | string | Aranacak film adı      |
| year      | string | Yıl filtresi (opsiyonel) |
| page      | number | Sayfa numarası (1, 2 …) |

**`getTorrents(url)`**
| Parametre | Tür    | Açıklama                    |
|-----------|--------|-----------------------------|
| url       | string | 1377x torrent sayfası URL'si |

---

### TorrentDownloads Scraper

TorrentDownloads.pro üzerinden film arama ve torrent bilgisi çekme.

```js
const { torrentDownloadsScraper } = require('@speed_of/movietorrent-scraper');

// Film arama (title, year?, page?)
const movies = await torrentDownloadsScraper.search('The Dark Knight', '2008');

console.log(movies);
// [
//   {
//     id: '9876543',
//     title: 'The Dark Knight 2008 1080p',
//     year: '2008',
//     rating: '3',          // health skoru
//     quality: '1080p',
//     size: '2.10GB',
//     seeds: 521,
//     leech: 48,
//     url: 'https://www.torrentdownloads.pro/torrent/9876543/...',
//     health: '3'
//   }, ...
// ]

// Torrent detay alma
const info = await torrentDownloadsScraper.getTorrentInfo('https://www.torrentdownloads.pro/torrent/9876543/...');

console.log(info);
// {
//   magnetLink: 'magnet:?xt=urn:btih:...',
//   infoHash: 'abc123...',
//   language: 'English'
// }
```

**`search(title, year?, page?)`**
| Parametre | Tür    | Varsayılan | Açıklama               |
|-----------|--------|------------|------------------------|
| title     | string | —          | Aranacak film adı      |
| year      | string | undefined  | Yıl filtresi (opsiyonel) |
| page      | number | 1          | Sayfa numarası         |

**`getTorrentInfo(url)`**
| Parametre | Tür    | Açıklama                          |
|-----------|--------|-----------------------------------|
| url       | string | TorrentDownloads torrent URL'si   |

---

## TypeScript

```ts
import { ytsMovieScraper, xtoMovieScraper, torrentDownloadsScraper } from '@speed_of/movietorrent-scraper';

const movies = await ytsMovieScraper.search('Inception', '2010');
```

---

## Test Komutları

```sh
npm run testYtsSearch
npm run testYtsGetTorrents
npm run testxtoSearch
npm run testxtoGetTorrents
npm run testTorrentDownloadsSearch
npm run testTorrentDownloadGetTorrents
```

---

## Bağımlılıklar

Harici bağımlılık yoktur. Node.js built-in `https`/`http` modülleri kullanılır (Node.js >= 12).

---

## Lisans

MIT — [Cengiz Karaaslan](https://github.com/cengizkaraaslan)