2016-11-27 01:58:25 -06:00

18 lines
488 B
Python

from . import yuku, pickle
scrapers = [yuku, pickle]
def get_scraper (name):
for scraper in scrapers:
if scraper.__name__.endswith(".{}".format(name)):
return scraper
raise Exception("Unknown scraper: {}".format(name))
def guess_scraper (url):
for scraper in scrapers:
if "can_scrape_url" in vars(scraper) and scraper.can_scrape_url(url):
return scraper
raise Exception("Unable to guess scraper for forum url: {}".format(url))