aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2018-07-06 18:17:54 -0700
committerJames Taylor <user234683@users.noreply.github.com>2018-07-06 18:17:54 -0700
commit237d19d834aa978fa4000d32c5c75600dbdce4e2 (patch)
tree08db2004ba9b782b44f917df513832791de28968
parent1eecc5a880a460ebe18d513a94010b265303d567 (diff)
downloadyt-local-237d19d834aa978fa4000d32c5c75600dbdce4e2.tar.lz
yt-local-237d19d834aa978fa4000d32c5c75600dbdce4e2.tar.xz
yt-local-237d19d834aa978fa4000d32c5c75600dbdce4e2.zip
remove grid-specific methods
-rw-r--r--youtube/channel.py43
1 files changed, 2 insertions, 41 deletions
diff --git a/youtube/channel.py b/youtube/channel.py
index 96e85c8..3238341 100644
--- a/youtube/channel.py
+++ b/youtube/channel.py
@@ -80,52 +80,13 @@ def get_channel_tab(channel_id, page="1", sort=3, tab='videos', view=1):
content = common.fetch_url(url, headers_1)
print("Finished recieving channel tab response")
- with open('debug/channel_debug', 'wb') as f:
- f.write(content)
+ '''with open('debug/channel_debug', 'wb') as f:
+ f.write(content)'''
info = json.loads(content)
return info
-grid_video_item_template = Template('''
- <div class="small-item-box">
- <div class="small-item">
- <a class="video-thumbnail-box" href="$url" title="$title">
- <img class="video-thumbnail-img" src="$thumbnail">
- <span class="video-duration">$duration</span>
- </a>
- <a class="title" href="$url" title="$title">$title</a>
-
- <span class="views">$views</span>
- <time datetime="$datetime">Uploaded $published</time>
-
- </div>
- <input class="item-checkbox" type="checkbox" name="video_info_list" value="$video_info" form="playlist-add">
- </div>
-''')
-def grid_video_item_info(grid_video_renderer, author):
- renderer = grid_video_renderer
- return {
- "title": renderer['title']['simpleText'],
- "id": renderer['videoId'],
- "views": renderer['viewCountText'].get('simpleText', None) or renderer['viewCountText']['runs'][0]['text'],
- "author": author,
- "duration": default_multi_get(renderer, 'lengthText', 'simpleText', default=''), # livestreams dont have a length
- "published": default_multi_get(renderer, 'publishedTimeText', 'simpleText', default=''),
- }
-
-def grid_video_item_html(item):
- video_info = json.dumps({key: item[key] for key in ('id', 'title', 'author', 'duration')})
- return grid_video_item_template.substitute(
- title = html.escape(item["title"]),
- views = item["views"],
- duration = item["duration"],
- url = URL_ORIGIN + "/watch?v=" + item["id"],
- thumbnail = get_thumbnail_url(item['id']),
- video_info = html.escape(json.dumps(video_info)),
- published = item["published"],
- datetime = '', # TODO
- )
def get_number_of_videos(channel_id):
# Uploads playlist