recipe_scrapers deprectation fix
This commit is contained in:
parent
ff43492265
commit
d1b9d15816
@ -1,6 +1,6 @@
|
||||
from bs4 import BeautifulSoup
|
||||
from json import JSONDecodeError
|
||||
from recipe_scrapers import SCRAPERS, get_domain, _exception_handling
|
||||
from recipe_scrapers import SCRAPERS, get_host_name
|
||||
from recipe_scrapers._factory import SchemaScraperFactory
|
||||
from recipe_scrapers._schemaorg import SchemaOrg
|
||||
|
||||
@ -17,7 +17,7 @@ SCRAPERS.update(CUSTOM_SCRAPERS)
|
||||
def text_scraper(text, url=None):
|
||||
domain = None
|
||||
if url:
|
||||
domain = get_domain(url)
|
||||
domain = get_host_name(url)
|
||||
if domain in SCRAPERS:
|
||||
scraper_class = SCRAPERS[domain]
|
||||
else:
|
||||
@ -25,12 +25,12 @@ def text_scraper(text, url=None):
|
||||
|
||||
class TextScraper(scraper_class):
|
||||
def __init__(
|
||||
self,
|
||||
page_data,
|
||||
url=None
|
||||
self,
|
||||
page_data,
|
||||
url=None
|
||||
):
|
||||
self.wild_mode = False
|
||||
self.exception_handling = _exception_handling
|
||||
self.exception_handling = None # TODO add new method here, old one was deprecated
|
||||
self.meta_http_equiv = False
|
||||
self.soup = BeautifulSoup(page_data, "html.parser")
|
||||
self.url = url
|
||||
|
Loading…
Reference in New Issue
Block a user