Package: yggtorrentscraper
YggTorrentScraperInstallationpipinstallyggtorrentscraperORclone this repository andpipinstall-rrequirements.txt

pythonsetup.pyinstallDependenciesBeautifulSoup 4lxmlrequestsUsageInitializationActual cloudflare bypassers likehttps://github.com/VeNoMouS/cloudscraperseem to have some difficulties for now.The easiest solution is to set Â« cf_clearance Â» cookie manually, you can find it in your browser.importrequestsfromyggtorrentscraperimportYggTorrentScrapercookie=requests.cookies.create_cookie(name="cf_clearance",value="1b23f59d619777532aea667960d00269fc49517e-1589279876-0-150",)session=requests.session()session.cookies.set_cookie(cookie)scraper=YggTorrentScraper(session)Selenium versionfromyggtorrentscraperimportYggTorrentScraperSeleniumfromseleniumimportwebdriveroptions=webdriver.ChromeOptions()options.add_argument("--log-level=3")options.add_argument("--disable-blink-features")options.add_argument("--disable-blink-features=AutomationControlled")options.add_experimental_option("excludeSwitches",["enable-logging"])driver=webdriver.Chrome("D:\chromedriver.exe",options=options)scraper=YggTorrentScraperSelenium(driver=driver)#ORscraper=YggTorrentScraperSelenium(driver_path="D:\chromedriver.exe")Change TLDYggTorrent TLD is change regularly, you can specify it at YggTorrentScraper construction with optionnal parameters yggtorrent_tldfromyggtorrentscraperimportset_yggtorrent_tldset_yggtorrent_tld("new_tld")Session is requiered to download torrentLogin (optionnal)I highly recommend you to not use your main account, YggTorrent ban botsRequiered only for download torrent's fileif(scraper.login("myidentifiant","mypassword")):print("Login success")else:print("Login failed")Search torrentsReturn url's results torrent for specified searchtorrents_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..."""Search an torrents by uploaderReturn url's results torrent for specified searchtorrents_url=scraper.search({name:"walking dead s09","uploader":'brandit'})Search torrents with sorted resultsReturn url's results torrent for specified searchYggTorrent's sorting is bugged, in general the results are sorted but sometimes you can find some torrents at a wrong positionsort : name/publish_date/size/completed/seed/leechorder : asc/desctorrents_url=scraper.search({"name":"blue oyster cult","sort":"completed","order":"desc"})Search by category, subcategory and options_indexComplete categories tree is available in filecategories.pyparameters={"name":"walking dead","category":"films_&_videos","subcategory":"serie_tv","options":{"langue":{"francais_(vff/truefrench)"},"episode":{"saison_complete"},"qualite":{"bluray_[full]"},},}research=scraper.search(parameters)Most completedReturn url's of most completed (top 100) downloaded torrentsmost_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..."""DetailsGet torrent's detailstorrent=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 !..."""DownloadDownload torrent's file (.torrent), requiered to be loggedif(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")Logout (optionnal)scraper.logout()TODOMore tests, find non bugged search (especially for sort tests)TestDeclare environment variables (requiered for login, download tests)YGGTORRENT_IDENTIFIANTYGGTORRENT_PASSWORDpipinstalltox

tox