aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/common.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2018-07-06 18:34:11 -0700
committerJames Taylor <user234683@users.noreply.github.com>2018-07-06 18:34:11 -0700
commit2ba4fd8994e6b82adae2316257868844208e657e (patch)
tree3d976f98e8b0f950ebdf2757da6fdafae8c6ea64 /youtube/common.py
parent237d19d834aa978fa4000d32c5c75600dbdce4e2 (diff)
downloadyt-local-2ba4fd8994e6b82adae2316257868844208e657e.tar.lz
yt-local-2ba4fd8994e6b82adae2316257868844208e657e.tar.xz
yt-local-2ba4fd8994e6b82adae2316257868844208e657e.zip
channel playlists: fix error when 0 playlists, correct stats for playlist
Diffstat (limited to 'youtube/common.py')
-rw-r--r--youtube/common.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/youtube/common.py b/youtube/common.py
index d9429a2..42d1381 100644
--- a/youtube/common.py
+++ b/youtube/common.py
@@ -60,7 +60,7 @@ medium_playlist_item_template = Template('''
<a class="title" href="$url" title="$title">$title</a>
- <address><a href="$author_url">$author</a></address>
+ <div class="stats">$stats</div>
</div>
''')
medium_video_item_template = Template('''
@@ -446,7 +446,7 @@ stat_templates = (
Template('''<span class="views">$views</span>'''),
Template('''<time datetime="$datetime">$published</time>'''),
)
-def get_video_stats(html_ready):
+def get_stats(html_ready):
stats = []
if 'author' in html_ready:
if 'author_url' in html_ready:
@@ -479,7 +479,7 @@ def video_item_html(item, template, html_exclude=set()):
for key in html_exclude:
del html_ready[key]
- html_ready['stats'] = get_video_stats(html_ready)
+ html_ready['stats'] = get_stats(html_ready)
return template.substitute(html_ready)
@@ -489,6 +489,11 @@ def playlist_item_html(item, template, html_exclude=set()):
html_ready['url'] = URL_ORIGIN + "/playlist?list=" + html_ready['id']
html_ready['datetime'] = '' #TODO
+
+ for key in html_exclude:
+ del html_ready[key]
+ html_ready['stats'] = get_stats(html_ready)
+
return template.substitute(html_ready)