cosmetic cleanup

This commit is contained in:
smilerz 2021-03-23 12:32:55 -05:00
parent cb708e7e47
commit 1188ed9227
2 changed files with 5 additions and 4 deletions

View File

@ -88,7 +88,6 @@ def get_recipe_from_source(text, url, space):
if 'url' in parse_list[0]: if 'url' in parse_list[0]:
url = parse_list[0]['url'] url = parse_list[0]['url']
# first try finding ld+json as its most common # first try finding ld+json as its most common
for el in parse_list: for el in parse_list:
@ -136,7 +135,7 @@ def get_from_html(soup):
html.append(s) html.append(s)
return html return html
# todo - look for site info in the soup
def get_images_from_source(soup, url): def get_images_from_source(soup, url):
sources = ['src', 'srcset', 'data-src'] sources = ['src', 'srcset', 'data-src']
images = [] images = []
@ -165,6 +164,7 @@ def get_images_from_source(soup, url):
images.append(u) images.append(u)
return images return images
def remove_graph(el): def remove_graph(el):
# recipes type might be wrapped in @graph type # recipes type might be wrapped in @graph type
if isinstance(el, Tag): if isinstance(el, Tag):

View File

@ -350,6 +350,7 @@ def parse_servings(servings):
servings = 1 servings = 1
return servings return servings
def parse_cooktime(cooktime): def parse_cooktime(cooktime):
if type(cooktime) not in [int, float]: if type(cooktime) not in [int, float]:
try: try: