Skip to content

Commit

Permalink
fix natgeo image downloader (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
guptarohit authored Oct 29, 2022
1 parent 4d9e73a commit 11cd4d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions freshpaper.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,14 @@ def download_image_nat_geo(download_dir, image_extension="jpg"):
raise ConnectionError

html = request.read().decode("utf-8")
url_regex = r"twitter:image:src\" content=\"(.*)\""
url_regex = r"twitter:image:src\" content=\"(.*?)\""
image_url = re.findall(url_regex, html)[0]

if not image_url:
log.info("No National Geographic image of the day available.\n")
return None

image_name_regex = r"json\":{\"title\":\"(.*)\""
image_name_regex = r"<span class=\"RichText\">(.*?)</span>"
image_name = re.findall(image_name_regex, html)[0]

try:
Expand Down

0 comments on commit 11cd4d5

Please sign in to comment.