Add custom boolean attribute for saved submissions of third-party links

This commit is contained in:
George Kaklamanos 2023-06-10 18:23:18 +03:00
parent 3c2b9c045c
commit 6a151991a6

View file

@ -41,6 +41,12 @@ with open("saved.yaml", "w") as file:
i["title"] = item.title
i["upvote_ratio"] = item.upvote_ratio
i["is_self"] = item.is_self
i["external_link"] = False
domains = ["redd.it","i.imgur.com","reddit.com"]
is_media = any(domain in item.url for domain in domains)
if not is_media and not item.is_self:
i["external_link"] = True
i["id"] = item.id
i["created_utc"] = item.created_utc