Skip to content

Commit

Permalink
don't post gif images re: #5
Browse files Browse the repository at this point in the history
  • Loading branch information
dphiffer committed May 25, 2024
1 parent 82609f1 commit b7419c9
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions best_of_mltshp.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,26 @@ def load_links():

for entry in input_feed.entries:
if entry.link not in links:

# Log the current link
links.append(entry.link)
save_links(links)

# Detect media from the RSS feed
(url, alt_text) = get_media(entry)
if not url:
continue

# Download the media
(filename, content_type) = download_media(url)
attachment = upload_media(filename, content_type, alt_text)
attachment = None
if content_type != "image/gif":
attachment = upload_media(filename, content_type, alt_text)
if "id" not in attachment:
print(attachment)
os.remove(filename)
if "id" not in attachment:
print(attachment)

# Post the toot
toot = post_toot(encode_toot(entry), attachment)
if toot and "id" in toot:
toot_id = toot["id"]
Expand Down

0 comments on commit b7419c9

Please sign in to comment.