Add custom boolean attribute for saved submissions of third-party links
This commit is contained in:
parent
3c2b9c045c
commit
6a151991a6
1 changed files with 6 additions and 0 deletions
6
main.py
6
main.py
|
@ -41,6 +41,12 @@ with open("saved.yaml", "w") as file:
|
||||||
i["title"] = item.title
|
i["title"] = item.title
|
||||||
i["upvote_ratio"] = item.upvote_ratio
|
i["upvote_ratio"] = item.upvote_ratio
|
||||||
i["is_self"] = item.is_self
|
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["id"] = item.id
|
||||||
i["created_utc"] = item.created_utc
|
i["created_utc"] = item.created_utc
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue