aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/channel.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2018-07-05 20:46:18 -0700
committerJames Taylor <user234683@users.noreply.github.com>2018-07-05 20:46:18 -0700
commit60fa26f459e8d19fe434ec37fd22fa4f1baa3f29 (patch)
treed0b4a7438e6f12bf0cfd909da1c50c34efbb9b38 /youtube/channel.py
parent25f3e2791c8e05d1466fe46c41d71288224bb6ec (diff)
downloadyt-local-60fa26f459e8d19fe434ec37fd22fa4f1baa3f29.tar.lz
yt-local-60fa26f459e8d19fe434ec37fd22fa4f1baa3f29.tar.xz
yt-local-60fa26f459e8d19fe434ec37fd22fa4f1baa3f29.zip
use unified item code for channel grid
Diffstat (limited to 'youtube/channel.py')
-rw-r--r--youtube/channel.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/youtube/channel.py b/youtube/channel.py
index 3cec09d..98014a3 100644
--- a/youtube/channel.py
+++ b/youtube/channel.py
@@ -151,6 +151,12 @@ def get_channel_id(username):
response = common.fetch_url(url, common.mobile_ua + headers_1).decode('utf-8')
return re.search(r'"channel_id":\s*"([a-zA-Z0-9_-]*)"', response).group(1)
+def grid_items_html(items, additional_info={}):
+ result = ''' <nav class="item-grid">\n'''
+ for item in items:
+ result += common.renderer_html(item, additional_info)
+ result += '''\n</nav>'''
+ return result
def channel_videos_html(polymer_json, current_page=1, number_of_videos = 1000, current_query_string=''):
microformat = polymer_json[1]['response']['microformat']['microformatDataRenderer']
@@ -166,9 +172,7 @@ def channel_videos_html(polymer_json, current_page=1, number_of_videos = 1000, c
items = []
else:
items = contents['twoColumnBrowseResultsRenderer']['tabs'][1]['tabRenderer']['content']['sectionListRenderer']['contents'][0]['itemSectionRenderer']['contents'][0]['gridRenderer']['items']
- items_html = ''
- for video in items:
- items_html += grid_video_item_html(grid_video_item_info(video['gridVideoRenderer'], microformat['title']))
+ items_html = grid_items_html(items, {'author': microformat['title']})
return yt_channel_items_template.substitute(
channel_title = microformat['title'],