handle feeds with enclosures (featured media / podcasts) #35

Merged
r merged 5 commits from r/konfluks:master into master 2022-06-01 06:05:37 +00:00
1 changed files with 3 additions and 1 deletions
Showing only changes of commit c84a975887 - Show all commits

View File

@ -206,6 +206,9 @@ def grab_media(post_directory, url, prefered_name=None):
shutil.copyfileobj(response.raw, media_file)
print('Downloaded media item', media_item)
return media_item
else:
print("Download failed", response.status_code)
return url
return media_item
elif os.path.exists(os.path.join(post_directory, media_item)):
return media_item
@ -227,7 +230,6 @@ def parse_posts(post_dir, post_content):
for img in soup(["img", "object"]):
if img.get("src") != None:
local_image = grab_media(post_dir, img["src"])
if img["src"] != local_image:
img["src"] = local_image