Ability to post comments (not reply yet)
This commit is contained in:
parent
6a6433619f
commit
fee24d4f0a
@ -169,7 +169,8 @@ def fetch_url(url, headers=(), timeout=15, report_text=None):
|
|||||||
content = gzip.decompress(content)
|
content = gzip.decompress(content)
|
||||||
return content
|
return content
|
||||||
|
|
||||||
mobile_ua = (('User-Agent', 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1'),)
|
mobile_user_agent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1'
|
||||||
|
mobile_ua = (('User-Agent', mobile_user_agent),)
|
||||||
|
|
||||||
def dict_add(*dicts):
|
def dict_add(*dicts):
|
||||||
for dictionary in dicts[1:]:
|
for dictionary in dicts[1:]:
|
||||||
|
@ -176,78 +176,6 @@ address{
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.full-item{
|
|
||||||
display: grid;
|
|
||||||
grid-template-rows: 0fr 0fr 0fr 0fr 20px 0fr 0fr;
|
|
||||||
grid-template-columns: 1fr 1fr;
|
|
||||||
align-content: start;
|
|
||||||
}
|
|
||||||
.full-item video{
|
|
||||||
grid-column: 1 / span 2;
|
|
||||||
grid-row: 1;
|
|
||||||
}
|
|
||||||
.full-item .title{
|
|
||||||
grid-column: 1 / span 2;
|
|
||||||
grid-row:2;
|
|
||||||
min-width: 0;
|
|
||||||
}
|
|
||||||
.full-item .is-unlisted{
|
|
||||||
background-color: #d0d0d0;
|
|
||||||
justify-self:start;
|
|
||||||
padding-left:2px;
|
|
||||||
padding-right:2px;
|
|
||||||
}
|
|
||||||
.full-item>address{
|
|
||||||
grid-column: 1;
|
|
||||||
grid-row: 4;
|
|
||||||
justify-self: start;
|
|
||||||
}
|
|
||||||
.full-item .views{
|
|
||||||
grid-column: 2;
|
|
||||||
grid-row: 4;
|
|
||||||
justify-self:end;
|
|
||||||
}
|
|
||||||
.full-item time{
|
|
||||||
grid-column: 1;
|
|
||||||
grid-row: 5;
|
|
||||||
justify-self:start;
|
|
||||||
}
|
|
||||||
.full-item .likes-dislikes{
|
|
||||||
grid-column: 2;
|
|
||||||
grid-row: 5;
|
|
||||||
justify-self:end;
|
|
||||||
}
|
|
||||||
.full-item .download-dropdown{
|
|
||||||
grid-column:1;
|
|
||||||
grid-row: 6;
|
|
||||||
}
|
|
||||||
.full-item .checkbox{
|
|
||||||
justify-self:end;
|
|
||||||
|
|
||||||
grid-row: 6;
|
|
||||||
grid-column: 2;
|
|
||||||
}
|
|
||||||
.full-item .description{
|
|
||||||
background-color:#d0d0d0;
|
|
||||||
margin-top:8px;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
min-width: 0;
|
|
||||||
|
|
||||||
grid-column: 1 / span 2;
|
|
||||||
grid-row: 7;
|
|
||||||
}
|
|
||||||
.full-item .music-list{
|
|
||||||
grid-row:8;
|
|
||||||
grid-column: 1 / span 2;
|
|
||||||
}
|
|
||||||
.full-item .comments{
|
|
||||||
grid-row: 9;
|
|
||||||
}
|
|
||||||
.full-item .more-comments{
|
|
||||||
grid-row: 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
.medium-item-box{
|
.medium-item-box{
|
||||||
|
|
||||||
display:grid;
|
display:grid;
|
||||||
|
@ -386,7 +386,6 @@ def get_watch_page(query_string):
|
|||||||
music_list_html += '''</table>\n'''
|
music_list_html += '''</table>\n'''
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
download_options = ''
|
download_options = ''
|
||||||
for format in info['formats']:
|
for format in info['formats']:
|
||||||
download_options += download_link_template.substitute(
|
download_options += download_link_template.substitute(
|
||||||
@ -396,6 +395,10 @@ def get_watch_page(query_string):
|
|||||||
note = html.escape(downloader._format_note(format)),
|
note = html.escape(downloader._format_note(format)),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
post_comment_url = common.URL_ORIGIN + "/post_comment?v=" + id
|
||||||
|
post_comment_link = '''<a class="post-comment-link" href="''' + post_comment_url + '''">Post comment</a>'''
|
||||||
|
|
||||||
|
|
||||||
page = yt_watch_template.substitute(
|
page = yt_watch_template.substitute(
|
||||||
video_title = html.escape(info["title"]),
|
video_title = html.escape(info["title"]),
|
||||||
page_title = html.escape(info["title"]),
|
page_title = html.escape(info["title"]),
|
||||||
@ -411,6 +414,8 @@ def get_watch_page(query_string):
|
|||||||
description = html.escape(info["description"]),
|
description = html.escape(info["description"]),
|
||||||
video_sources = formats_html(sorted_formats) + subtitles_html(info),
|
video_sources = formats_html(sorted_formats) + subtitles_html(info),
|
||||||
related = related_videos_html,
|
related = related_videos_html,
|
||||||
|
post_comment_link = post_comment_link,
|
||||||
|
comment_count = '',
|
||||||
comments = comments_html,
|
comments = comments_html,
|
||||||
more_comments_button = more_comments_button,
|
more_comments_button = more_comments_button,
|
||||||
music_list = music_list_html,
|
music_list = music_list_html,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import mimetypes
|
import mimetypes
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
from youtube import local_playlist, watch, search, playlist, channel, comments, common
|
from youtube import local_playlist, watch, search, playlist, channel, comments, common, account_functions
|
||||||
YOUTUBE_FILES = (
|
YOUTUBE_FILES = (
|
||||||
"/shared.css",
|
"/shared.css",
|
||||||
"/opensearch.xml",
|
"/opensearch.xml",
|
||||||
@ -52,6 +52,9 @@ def youtube(env, start_response):
|
|||||||
result = common.fetch_url('https://www.youtube.com' + path + ('?' + query_string if query_string else ''))
|
result = common.fetch_url('https://www.youtube.com' + path + ('?' + query_string if query_string else ''))
|
||||||
result = result.replace(b"align:start position:0%", b"")
|
result = result.replace(b"align:start position:0%", b"")
|
||||||
return result
|
return result
|
||||||
|
elif path == "/post_comment":
|
||||||
|
start_response('200 OK', () )
|
||||||
|
return account_functions.get_post_comment_page(query_string).encode()
|
||||||
else:
|
else:
|
||||||
start_response('404 Not Found', () )
|
start_response('404 Not Found', () )
|
||||||
return b'404 Not Found'
|
return b'404 Not Found'
|
||||||
@ -77,6 +80,10 @@ def youtube(env, start_response):
|
|||||||
else:
|
else:
|
||||||
start_response('400 Bad Request', ())
|
start_response('400 Bad Request', ())
|
||||||
return b'400 Bad Request'
|
return b'400 Bad Request'
|
||||||
|
elif path == "/post_comment":
|
||||||
|
start_response('200 OK', () )
|
||||||
|
return account_functions.post_comment(query_string, fields).encode()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
start_response('404 Not Found', ())
|
start_response('404 Not Found', ())
|
||||||
return b'404 Not Found'
|
return b'404 Not Found'
|
||||||
|
@ -22,8 +22,93 @@
|
|||||||
grid-template-columns: 1fr 640px;
|
grid-template-columns: 1fr 640px;
|
||||||
}
|
}
|
||||||
.full-item{
|
.full-item{
|
||||||
|
display: grid;
|
||||||
|
grid-column: 2;
|
||||||
|
grid-template-rows: 0fr 0fr 0fr 0fr 20px 0fr 0fr;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
align-content: start;
|
||||||
|
}
|
||||||
|
.full-item > video{
|
||||||
|
grid-column: 1 / span 2;
|
||||||
|
grid-row: 1;
|
||||||
|
}
|
||||||
|
.full-item > .title{
|
||||||
|
grid-column: 1 / span 2;
|
||||||
|
grid-row:2;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
.full-item > .is-unlisted{
|
||||||
|
background-color: #d0d0d0;
|
||||||
|
justify-self:start;
|
||||||
|
padding-left:2px;
|
||||||
|
padding-right:2px;
|
||||||
|
}
|
||||||
|
.full-item > address{
|
||||||
|
grid-column: 1;
|
||||||
|
grid-row: 4;
|
||||||
|
justify-self: start;
|
||||||
|
}
|
||||||
|
.full-item > .views{
|
||||||
|
grid-column: 2;
|
||||||
|
grid-row: 4;
|
||||||
|
justify-self:end;
|
||||||
|
}
|
||||||
|
.full-item > time{
|
||||||
|
grid-column: 1;
|
||||||
|
grid-row: 5;
|
||||||
|
justify-self:start;
|
||||||
|
}
|
||||||
|
.full-item > .likes-dislikes{
|
||||||
|
grid-column: 2;
|
||||||
|
grid-row: 5;
|
||||||
|
justify-self:end;
|
||||||
|
}
|
||||||
|
.full-item > .download-dropdown{
|
||||||
|
grid-column:1;
|
||||||
|
grid-row: 6;
|
||||||
|
}
|
||||||
|
.full-item > .checkbox{
|
||||||
|
justify-self:end;
|
||||||
|
|
||||||
|
grid-row: 6;
|
||||||
grid-column: 2;
|
grid-column: 2;
|
||||||
}
|
}
|
||||||
|
.full-item > .description{
|
||||||
|
background-color:#d0d0d0;
|
||||||
|
margin-top:8px;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
min-width: 0;
|
||||||
|
|
||||||
|
grid-column: 1 / span 2;
|
||||||
|
grid-row: 7;
|
||||||
|
}
|
||||||
|
.full-item .music-list{
|
||||||
|
grid-row:8;
|
||||||
|
grid-column: 1 / span 2;
|
||||||
|
}
|
||||||
|
.comment-count{
|
||||||
|
font-weight:bold;
|
||||||
|
grid-row:9;
|
||||||
|
grid-column: 1 / span 2;
|
||||||
|
}
|
||||||
|
.post-comment-link{
|
||||||
|
grid-row:10;
|
||||||
|
grid-column: 1;
|
||||||
|
justify-self:start;
|
||||||
|
}
|
||||||
|
.full-item .comments{
|
||||||
|
grid-column: 1 / span 2;
|
||||||
|
grid-row: 11;
|
||||||
|
margin-top:10px;
|
||||||
|
}
|
||||||
|
.comment{
|
||||||
|
width:640px;
|
||||||
|
}
|
||||||
|
.full-item .more-comments{
|
||||||
|
grid-row: 12;
|
||||||
|
grid-column: 1 / span 2;
|
||||||
|
}
|
||||||
|
|
||||||
.music-list{
|
.music-list{
|
||||||
background-color: #d0d0d0;
|
background-color: #d0d0d0;
|
||||||
}
|
}
|
||||||
@ -39,17 +124,6 @@
|
|||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
margin-bottom:5px;
|
margin-bottom:5px;
|
||||||
}
|
}
|
||||||
.comments{
|
|
||||||
grid-column: 1 / span 2;
|
|
||||||
grid-row: 6;
|
|
||||||
margin-top:10px;
|
|
||||||
}
|
|
||||||
.comment{
|
|
||||||
width:640px;
|
|
||||||
}
|
|
||||||
.more-comments{
|
|
||||||
grid-column: 1 / span 2;
|
|
||||||
}
|
|
||||||
#right{
|
#right{
|
||||||
background-color:#cccccc;
|
background-color:#cccccc;
|
||||||
grid-column: 2;
|
grid-column: 2;
|
||||||
@ -129,6 +203,8 @@ $download_options
|
|||||||
<div class="music-list">
|
<div class="music-list">
|
||||||
$music_list
|
$music_list
|
||||||
</div>
|
</div>
|
||||||
|
<div class="comment-count">$comment_count</div>
|
||||||
|
$post_comment_link
|
||||||
<section class="comments">
|
<section class="comments">
|
||||||
$comments
|
$comments
|
||||||
</section>
|
</section>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user