aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/comments.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2018-08-31 16:23:19 -0700
committerJames Taylor <user234683@users.noreply.github.com>2018-08-31 16:23:19 -0700
commitebfe58e6cbc866c5e2dc4876a6b5868837d504b3 (patch)
tree3de4d65fd73349963a1aca6a9e410fde23ded8c2 /youtube/comments.py
parent6980d93107354a8c075030a7bda4c3870449163b (diff)
downloadyt-local-ebfe58e6cbc866c5e2dc4876a6b5868837d504b3.tar.lz
yt-local-ebfe58e6cbc866c5e2dc4876a6b5868837d504b3.tar.xz
yt-local-ebfe58e6cbc866c5e2dc4876a6b5868837d504b3.zip
Ability to reply to comments
Diffstat (limited to 'youtube/comments.py')
-rw-r--r--youtube/comments.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/youtube/comments.py b/youtube/comments.py
index 5490938..a1f08bf 100644
--- a/youtube/comments.py
+++ b/youtube/comments.py
@@ -206,7 +206,6 @@ def parse_comments_polymer(content, replies=False):
print('Error parsing comments: ' + str(e))
comments = ()
ctoken = ''
- raise
else:
print("Finished getting and parsing comments")
return {'ctoken': ctoken, 'comments': comments, 'video_title': video_title}
@@ -273,6 +272,10 @@ def get_comments_page(query_string):
if replies:
page_title = 'Replies'
video_metadata = ''
+ comment_box = '''<form action="" method="post" class="comment-form">
+ <textarea name="comment_text"></textarea>
+ <button type="submit" class="post-comment-button">Post reply</button>
+</form>'''
else:
page_number = str(int(metadata['offset']/20) + 1)
page_title = 'Comments page ' + page_number
@@ -283,6 +286,7 @@ def get_comments_page(query_string):
url = common.URL_ORIGIN + '/watch?v=' + metadata['video_id'],
thumbnail = '/i.ytimg.com/vi/'+ metadata['video_id'] + '/mqdefault.jpg',
)
+ comment_box = ''
comments_html, ctoken = get_comments_html(parsed_comments)
@@ -293,6 +297,7 @@ def get_comments_page(query_string):
return yt_comments_template.substitute(
header = common.get_header(),
+ comment_box = comment_box,
video_metadata = video_metadata,
comments = comments_html,
page_title = page_title,