Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Scraper for YggTorrent

Project description

YggTorrentScraper

Codacy Badge Build Status codecov

Installation

pip install yggtorrentscraper

OR

clone this repository and

python setup.py install

Dependencies

Usage

Initialization

import requests
from yggtorrentscraper import YggTorrentScraper

scraper = YggTorrentScraper(requests.session())

Change TLD

YggTorrent TLD is change regularly, you can specify it at YggTorrentScraper construction with optionnal parameters yggtorrent_tld

import requests
from yggtorrentscraper import YggTorrentScraper

scraper = YggTorrentScraper(requests.session(), yggtorrent_tld="new_tld")

Session is requiered to download torrent

Login (optionnal)

Requiered only for download torrent's file

scraper.login(identifiant='myidentifiant', password='mypassword')

Research an torrent

Return url's results torrent for specified research

research = 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-expm5
https://www2.yggtorrent.ch/torrent/filmvidâ–’o/sâ–’rie-tv/227752-the+walking+dead+s08+complete+vostfr+proper+hdtv+xvid-expm5
https://www2.yggtorrent.ch/torrent/filmvidâ–’o/sâ–’rie-tv/227763-the+walking+dead+s08+vostfr+web-dl+x264-ark01
https://www2.yggtorrent.ch/torrent/filmvidâ–’o/sâ–’rie-tv/227764-the+walking+dead+s08+vostfr+720p+amzn+web-dl+dd5+1+h264-ark01
https://www2.yggtorrent.ch/torrent/filmvidâ–’o/sâ–’rie-tv/227765-the+walking+dead+s08+vostfr+1080p+amzn+web-dl+ddp5+1+h264-ark01

...

'''

Most completed

Return url's of most completed (top 100) downloaded torrents

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-ark01
https://www2.yggtorrent.ch/torrent/application/windows/316475-microsoft-toolkit-v2-6-4-activateur-office-2016---2019-windows-10
https://www2.yggtorrent.ch/torrent/filmvideo/animation/431851-asterix-le-secret-de-la-potion-magique-2018-french-1080p-hdlight-x264-ac3-toxic
https://www2.yggtorrent.ch/torrent/application/windows/330032-windows-microsoft-office-2019-build-10730-20102-activation-francais
https://www2.yggtorrent.ch/torrent/filmvideo/serie-tv/436928-game-of-thrones-s08e01-multi-1080p-amzn-web-dl-dd5-1-h264-ark01

...

'''

Details

Get torrent's details

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-ARK01
Url       : N/A (Not authentified)
Uploaded  : 2019-04-22 06:10:00
Size      : 1.40Go
Uploader  : Anonyme
Completed : 37157
Seeders   : 2254
Leechers  : 2

Files (1) :

Comments (15) :

'''

print(torrent.__str__(files=True, comments=True))

'''
Name      : Game.of.Thrones.S08E02.MULTi.1080p.AMZN.WEB-DL.DD5.1.x264-ARK01
Url       : N/A
Uploaded  : 2019-04-22 06:10:00
Size      : 1.40Go
Uploader  : Anonyme
Completed : 37157
Seeders   : 2254
Leechers  : 2

Files (1) :
size      :
file_name :Game.of.Thrones.S08E02.MULTi.1080p.AMZN.WEB-DL.DD5.1.x264-ARK01.mkv"}


Comments (15) :
Author : Beleg_5
Posted : 10 jours
Text   : Merci beaucoup.

Author : StephZher
Posted : 20 jours
Text   : Merci c'est cool !

...

'''

Download

Download torrent's file (.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')

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')

Logout (optionnal)

scraper.logout()

Test

Declare environment variables (requiered for login, download tests)

  • YGGTORRENT_IDENTIFIANT
  • YGGTORRENT_PASSWORD
pip install tox

tox

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for yggtorrentscraper, version 1.1.10
Filename, size File type Python version Upload date Hashes
Filename, size yggtorrentscraper-1.1.10.tar.gz (10.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page