Take crosspost parent as url when available.

master
voussoir 2022-09-10 11:30:58 -07:00
parent 08cfa3db0e
commit c8c160e00e
No known key found for this signature in database
GPG Key ID: 5F7554F8C26DACCB
1 changed files with 6 additions and 1 deletions

View File

@ -396,8 +396,13 @@ class TSDB:
if submission.is_self: if submission.is_self:
# Selfpost's URL leads back to itself, so just ignore it. # Selfpost's URL leads back to itself, so just ignore it.
url = None url = None
elif hasattr(submission, 'crosspost_parent') and getattr(submission, 'crosspost_parent_list'):
url = submission.crosspost_parent_list[0]['permalink']
else: else:
url = submission.url url = getattr(submission, 'url', None)
if url and url.startswith('/r/'):
url = 'https://reddit.com' + url
postdata = { postdata = {
'idint': common.b36(submission.id), 'idint': common.b36(submission.id),