sergey-s-moiseev / torrent-scraper
Provide an abstraction to seach for torrent files on many websites.
v1.0.4
2016-10-14 02:58 UTC
Requires
- php: >=5.5
- ext-curl: *
- guzzlehttp/guzzle: ~6.2
- symfony/css-selector: >=2.6
- symfony/dom-crawler: >=2.6
Requires (Dev)
- phpunit/phpunit: 5.2.*
- squizlabs/php_codesniffer: 2.*
- symfony/var-dumper: >=2.6
README
About
This library provides an abstraction to search for torrent files accross some torrent websites.
Usage
<?php $scraperService = new \SergeySMoiseev\TorrentScraper\TorrentScraperService([ \SergeySMoiseev\TorrentScraper\Adapter\EzTvAdapter::ADAPTER_NAME, \SergeySMoiseev\TorrentScraper\Adapter\KickassTorrentsAdapter::ADAPTER_NAME ]); $results = $scraperService->search('query'); foreach ($results as $result) { $result->getName(); $result->getSource(); $result->getSeeders(); $result->getLeechers(); $result->getTorrentUrl(); $result->getMagnetUrl(); $result->getDetailsUrl(); $result->getCategory(); $result->getSize(); }
Additional torrents info
For scrap Seeds and Peers by Announce trackers use python daemon in /daemon folder
Daemon usage
python daemon/main.py
Server was started on 0.0.0.0:5000 (by default) for get additional information you need to send post JSON request [Content-Type:application/json] on server
{"data": { "trackers": ["udp://tracker1.wasabii.com.tw:6969/announce","…"], "hashes": ["89925fb48cae260801f35fb7175530bf6e5e055a", "…"] }, "callback": "http://yousite.url/callback_action", "private_key": "your_ip_key" }
Where:
- trackers - list of announce servers
- hashes - torrent hashes
- callback - url to you callback action for result JSON ('http://' or 'https://" is
important
!) - private_key - self generated key for protect your action (
recommendation:make new key for each request
) ``
Result JSON format:
{"data": [ {"89925fb48cae260801f35fb7175530bf6e5e055a": {"peers": 1234, "seeds": 4321}, "…" ] }
<?php $scraperService = new \SergeySMoiseev\TorrentScraper\TorrentScraperService(); $query = [ "trackers": ["udp://tracker1.wasabii.com.tw:6969/announce","…"], "hashes": ["89925fb48cae260801f35fb7175530bf6e5e055a", "…"] ]; $results = $scraperService->scrap($query, "http://yousite.url/callback_action", "your_ip_key");
Result will come on callback URL after collect information from announce trackers
Check Daemon is running
<?php $scraperService = new \SergeySMoiseev\TorrentScraper\TorrentScraperService(); $results = $scraperService->ping();