Getting donation links without fluff

main
Bob Mottram 2024-08-12 22:08:01 +01:00
parent ce69d66739
commit 34e8453fd5
1 changed files with 8 additions and 6 deletions

View File

@ -62,12 +62,14 @@ def get_donation_url(actor_json: {}) -> str:
continue continue
if not property_value['type'].endswith('PropertyValue'): if not property_value['type'].endswith('PropertyValue'):
continue continue
if '<a href="' not in property_value[prop_value_name]: if '<a href="' in property_value[prop_value_name]:
continue donate_url = property_value[prop_value_name].split('<a href="')[1]
donate_url = property_value[prop_value_name].split('<a href="')[1] if '"' in donate_url:
if '"' in donate_url: donate_url = donate_url.split('"')[0]
donate_url = donate_url.split('"')[0] donate_url = remove_html(donate_url)
donate_url = remove_html(donate_url) return remove_link_tracking(donate_url)
else:
donate_url = remove_html(property_value[prop_value_name])
return remove_link_tracking(donate_url) return remove_link_tracking(donate_url)
return '' return ''