Channel about: Add http:// to links without it

So that the link is not interpretted as a relative link

Signed-off-by: Jesús <heckyel@hyperbola.info>
This commit is contained in:
James Taylor 2021-04-25 10:35:45 -07:00 committed by Jesús
parent 7feea3f839
commit 0ee448c186
No known key found for this signature in database
GPG Key ID: F6EE7BC59A315766

View File

@ -89,6 +89,8 @@ def extract_channel_info(polymer_json, tab):
info['links'] = []
for link_json in channel_metadata.get('primaryLinks', ()):
url = remove_redirect(deep_get(link_json, 'navigationEndpoint', 'urlEndpoint', 'url'))
if not (url.startswith('http://') or url.startswith('https://')):
url = 'http://' + url
text = extract_str(link_json.get('title'))
info['links'].append( (text, url) )