Skip to content

Instantly share code, notes, and snippets.

@elraro
Created October 22, 2016 22:07
Show Gist options
  • Save elraro/1d19c24c92308fbbe43899d974ec9569 to your computer and use it in GitHub Desktop.
Save elraro/1d19c24c92308fbbe43899d974ec9569 to your computer and use it in GitHub Desktop.
Download Doctor Who
from robobrowser import RoboBrowser
from requests import Session
from time import sleep
from urllib.request import urlretrieve
session = Session()
session.verify = False # Skip SSL verification
browser = RoboBrowser(session=session,parser="lxml")
browser.open("http://www.bricocine.com/c/series/doctor-who/")
doctor_who = browser.parsed.find("div", {"id": "NormalBlock"})
sleep(2)
for temp in doctor_who.findAll("div", {"class": "entry"}):
for link in temp.findAll("a"):
browser.open(link["href"])
print(link["href"])
torrent_links = browser.get_links("Descargar .torrent")
for torrent_web in torrent_links:
print("Abriendo " + torrent_web["href"])
browser.session.headers['Referer'] = link["href"]
browser.follow_link(torrent_web)
# print(browser.parsed)
torrent = browser.parsed.find("a", {"class": "btn btn-primary btn-small"})
print("Descargando " + torrent["href"])
filename = "./" + torrent["href"].split("/")[-1]
urlretrieve(torrent["href"], filename)
sleep(2)
sleep(2)
sleep(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment