aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2021-04-25 10:35:45 -0700
committerJesús <heckyel@hyperbola.info>2021-05-06 15:21:36 -0500
commit0ee448c1862ce1d806d8a887f6dae8c3b5e6d678 (patch)
treed813b996ce3afc375cbe80b142ef6b269dd63bf1
parent7feea3f839b4e78b865937e74689486a54ba0b92 (diff)
downloadyt-local-0ee448c1862ce1d806d8a887f6dae8c3b5e6d678.tar.lz
yt-local-0ee448c1862ce1d806d8a887f6dae8c3b5e6d678.tar.xz
yt-local-0ee448c1862ce1d806d8a887f6dae8c3b5e6d678.zip
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>
-rw-r--r--youtube/yt_data_extract/everything_else.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/youtube/yt_data_extract/everything_else.py b/youtube/yt_data_extract/everything_else.py
index f9c47cb..7020df8 100644
--- a/youtube/yt_data_extract/everything_else.py
+++ b/youtube/yt_data_extract/everything_else.py
@@ -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) )