From c8c160e00e600b5ee84c26044cbe6855eb96cacf Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 10 Sep 2022 11:30:58 -0700 Subject: [PATCH] Take crosspost parent as url when available. --- timesearch_modules/tsdb.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/timesearch_modules/tsdb.py b/timesearch_modules/tsdb.py index b45f014..798d0e7 100644 --- a/timesearch_modules/tsdb.py +++ b/timesearch_modules/tsdb.py @@ -396,8 +396,13 @@ class TSDB: if submission.is_self: # Selfpost's URL leads back to itself, so just ignore it. url = None + elif hasattr(submission, 'crosspost_parent') and getattr(submission, 'crosspost_parent_list'): + url = submission.crosspost_parent_list[0]['permalink'] else: - url = submission.url + url = getattr(submission, 'url', None) + + if url and url.startswith('/r/'): + url = 'https://reddit.com' + url postdata = { 'idint': common.b36(submission.id),