Check to ensure appends are strings

pull/11/head
Anson Lai 3 years ago
parent 704533acbd
commit f336f9dbae

@ -182,12 +182,14 @@ class Webdriver:
def append_upcoming_and_img_urls(source): def append_upcoming_and_img_urls(source):
soup = BeautifulSoup(source, 'html.parser') soup = BeautifulSoup(source, 'html.parser')
for link in soup.find_all('a'): for link in soup.find_all('a'):
if type(link.get('href')) == str:
if link.get('href') not in visited_urls and link.get('href') not in banned_urls and link.get('href') not in upcoming_urls: if link.get('href') not in visited_urls and link.get('href') not in banned_urls and link.get('href') not in upcoming_urls:
if link.get('href').startswith('GUID') and link.get('href').endswith('.html'): if link.get('href').startswith('GUID') and link.get('href').endswith('.html'):
upcoming_urls.append(link.get('href')) upcoming_urls.append(link.get('href'))
for img in soup.find_all('img'): for img in soup.find_all('img'):
if img.get('src') not in img_urls: if img.get('src') not in img_urls:
if type(img.get('src')) == str:
img_urls.append(img.get('src')) img_urls.append(img.get('src'))
def check_source_validity(source): def check_source_validity(source):

Loading…
Cancel
Save