aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/channel.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2018-11-08 22:31:19 -0800
committerJames Taylor <user234683@users.noreply.github.com>2018-11-08 22:31:19 -0800
commitf6778f8c3d0f9fe5c1d496313c8c6119e4dba3bb (patch)
treebcc82cd4e2e7f281854ca952d238b619108c5207 /youtube/channel.py
parent4b9e9529bed5c8366f8ba67db8fae27cf335b852 (diff)
downloadyt-local-f6778f8c3d0f9fe5c1d496313c8c6119e4dba3bb.tar.lz
yt-local-f6778f8c3d0f9fe5c1d496313c8c6119e4dba3bb.tar.xz
yt-local-f6778f8c3d0f9fe5c1d496313c8c6119e4dba3bb.zip
channel about page: remove /redirect in links
Diffstat (limited to 'youtube/channel.py')
-rw-r--r--youtube/channel.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/youtube/channel.py b/youtube/channel.py
index adc8929..ce0ecba 100644
--- a/youtube/channel.py
+++ b/youtube/channel.py
@@ -244,8 +244,13 @@ def channel_about_page(polymer_json):
channel_metadata = tab_with_content(polymer_json[1]['response']['contents']['twoColumnBrowseResultsRenderer']['tabs'])['sectionListRenderer']['contents'][0]['itemSectionRenderer']['contents'][0]['channelAboutFullMetadataRenderer']
channel_links = ''
for link_json in channel_metadata.get('primaryLinks', ()):
+ url = link_json['navigationEndpoint']['urlEndpoint']['url']
+ if url.startswith("/redirect"):
+ query_string = url[url.find('?')+1: ]
+ url = urllib.parse.parse_qs(query_string)['q'][0]
+
channel_links += channel_link_template.substitute(
- url = html.escape(link_json['navigationEndpoint']['urlEndpoint']['url']),
+ url = html.escape(url),
text = common.get_plain_text(link_json['title']),
)