From 0ee448c1862ce1d806d8a887f6dae8c3b5e6d678 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Sun, 25 Apr 2021 10:35:45 -0700 Subject: Channel about: Add http:// to links without it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So that the link is not interpretted as a relative link Signed-off-by: Jesús --- youtube/yt_data_extract/everything_else.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'youtube') 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) ) -- cgit v1.2.3