astroport-iptubes/crawl.py

46 lines
1.2 KiB
Python
Executable File

################################################################################
# Author: Poka (poka@p2p.legal)
# Version: 0.0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
# Git: https://git.p2p.legal/axiom-team/astroport
################################################################################
import requests
import json
import sys
import login
# Load scraper
from yggcrawl import YggTorrentScraper
scraper = YggTorrentScraper(requests.session())
from yggtorrentscraper import set_yggtorrent_tld
set_yggtorrent_tld("se")
name = sys.argv[1]
# Give paramaters to scraper
parameters = {
"name": name,
"category": "films_&_videos",
"subcategory": "film",
"options": {
"langue": {"francais_(vff/truefrench)"},
},
"sort": "seed",
"order": "desc"
}
# Execute scrapping
research = scraper.search(parameters)
most_completed = scraper.most_completed()
#print(json.dumps(research, sort_keys=True, indent=4))
#print(json.dumps(most_completed, sort_keys=True, indent=4))
# Download torrent file
if(scraper.login(login.user, login.passwd)):
print("Login success")
first_torrent = research[0]
scraper.download_from_torrent_url(first_torrent)
else:
print("Login failed")