YggTorrent刮板
yggtorrent的Python项目详细描述
YGG铲土机
安装
pip install yggtorrentscraper
或者
克隆此存储库并
^{pr2}$依赖性
使用
初始化
importrequestsfromyggtorrentscraperimportYggTorrentScraperscraper=YggTorrentScraper(requests.session())
更改TLD
YggTorrent TLD是定期更改的,您可以使用可选参数YggTorrent TLD在YggTorrent scraper构造中指定它
fromyggtorrentscraperimportset_yggtorrent_tldset_yggtorrent_tld("new_tld")
下载torrent需要会话
登录(可选)
我强烈建议您不要使用您的主帐户YggTorrent ban bots
只需要下载torrent的文件
if(scraper.login("myidentifiant","mypassword")):print("Login success")else:print("Login failed")
搜索torrents
返回指定搜索的url结果torrent
torrents_url=scraper.search({name:"walking dead s08"})"""https://www2.yggtorrent.ch/torrent/filmvidâ–’o/sâ–’rie-tv/227730-the+walking+dead+s08+complete+vostfr+proper+720p+hdtv+x264-expm5https://www2.yggtorrent.ch/torrent/filmvidâ–’o/sâ–’rie-tv/227752-the+walking+dead+s08+complete+vostfr+proper+hdtv+xvid-expm5https://www2.yggtorrent.ch/torrent/filmvidâ–’o/sâ–’rie-tv/227763-the+walking+dead+s08+vostfr+web-dl+x264-ark01https://www2.yggtorrent.ch/torrent/filmvidâ–’o/sâ–’rie-tv/227764-the+walking+dead+s08+vostfr+720p+amzn+web-dl+dd5+1+h264-ark01https://www2.yggtorrent.ch/torrent/filmvidâ–’o/sâ–’rie-tv/227765-the+walking+dead+s08+vostfr+1080p+amzn+web-dl+ddp5+1+h264-ark01..."""
通过上传程序搜索torrents
返回指定搜索的url结果torrent
torrents_url=scraper.search({name:"walking dead s09","uploader":'brandit'})
搜索包含排序结果的Torrent
返回指定搜索的url结果torrent
YggTorrent的排序有问题,一般情况下,结果会被排序,但有时您会在错误的位置找到一些torrent
- 排序:名称/发布日期/大小/已完成/种子/水蛭
- 顺序:asc/desc
torrents_url=scraper.search({"name":"blue oyster cult","sort":"completed","order":"desc"})
按类别、子类别和选项搜索索引
完整类别树在文件categories.py中可用
parameters={"name":"walking dead","category":"films_&_videos","subcategory":"serie_tv","options":{"langue":{"francais_(vff/truefrench)"},"episode":{"saison_complete"},"qualite":{"bluray_[full]"},},}research=scraper.search(parameters)
大部分完成
返回大多数已完成(前100)下载的Torrent的url
most_completed=scraper.most_completed()"""https://www2.yggtorrent.ch/torrent/filmvideo/serie-tv/440445-game-of-thrones-s08e02-multi-1080p-amzn-web-dl-dd5-1-x264-ark01https://www2.yggtorrent.ch/torrent/application/windows/316475-microsoft-toolkit-v2-6-4-activateur-office-2016---2019-windows-10https://www2.yggtorrent.ch/torrent/filmvideo/animation/431851-asterix-le-secret-de-la-potion-magique-2018-french-1080p-hdlight-x264-ac3-toxichttps://www2.yggtorrent.ch/torrent/application/windows/330032-windows-microsoft-office-2019-build-10730-20102-activation-francaishttps://www2.yggtorrent.ch/torrent/filmvideo/serie-tv/436928-game-of-thrones-s08e01-multi-1080p-amzn-web-dl-dd5-1-h264-ark01..."""
详情
获取torrent的详细信息
torrent=scraper.extract_details('https://www2.yggtorrent.ch/torrent/filmvideo/serie-tv/440445-game-of-thrones-s08e02-multi-1080p-amzn-web-dl-dd5-1-x264-ark01')print(torrent)"""Name : Game.of.Thrones.S08E02.MULTi.1080p.AMZN.WEB-DL.DD5.1.x264-ARK01Url : N/A (Not authentified)Uploaded : 2019-04-22 06:10:00Size : 1.40GoUploader : AnonymeCompleted : 37157Seeders : 2254Leechers : 2Files (1) :Comments (15) :"""print(torrent.__str__(files=True,comments=True))"""Name : Game.of.Thrones.S08E02.MULTi.1080p.AMZN.WEB-DL.DD5.1.x264-ARK01Url : N/AUploaded : 2019-04-22 06:10:00Size : 1.40GoUploader : AnonymeCompleted : 37157Seeders : 2254Leechers : 2Files (1) :size :file_name :Game.of.Thrones.S08E02.MULTi.1080p.AMZN.WEB-DL.DD5.1.x264-ARK01.mkv"}Comments (15) :Author : Beleg_5Posted : 10 joursText : Merci beaucoup.Author : StephZherPosted : 20 joursText : Merci c'est cool !..."""
下载
下载torrent的文件(.torrent),需要记录
if(scraper.login("myidentifiant","mypassword")):print("Login success")torrent=scraper.extract_details('https://www2.yggtorrent.ch/torrent/filmvideo/serie-tv/440445-game-of-thrones-s08e02-multi-1080p-amzn-web-dl-dd5-1-x264-ark01')scraper.download_from_torrent(torrent)""" OR """scraper.download_from_torrent_url('https://www2.yggtorrent.ch/torrent/filmvideo/serie-tv/440445-game-of-thrones-s08e02-multi-1080p-amzn-web-dl-dd5-1-x264-ark01')else:print("Login failed")
注销(可选)
scraper.logout()
托多
- 更多测试,查找无错误的搜索(特别是排序测试)
试验
声明环境变量(登录、下载测试需要)
- Ygg纠正剂
- YGGTORRENT_密码
pip install tox tox
- 项目
标签: