Skip to content

Commit

Permalink
Update scrapers.py
Browse files Browse the repository at this point in the history
  • Loading branch information
bfeldman89 committed Nov 26, 2020
1 parent 14e67ba commit cbb976b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scrapers.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,12 @@ def hcdc_scraper():
time.sleep(5)
continue
try:
this_dict['img_src'] = urllib.parse.urljoin(main_url, soup.find('img', {'align': 'middle'})['src'])
img_src = urllib.parse.urljoin(main_url, soup.find('img', {'align': 'middle'})['src'])
img_src_r = requests.get(img_src)
if img_src_r.headers['Content-Type'] == 'image/jpeg':
this_dict['img_src'] = img_src
else:
print('image source isn\'t actually an image')
except TypeError:
print('no pic at this time')
# a simpler solution might be to just do this
Expand Down

0 comments on commit cbb976b

Please sign in to comment.