remove trailing whitespaces
This commit is contained in:
parent
c696db3e84
commit
a27b575380
@ -119,7 +119,7 @@ wine_run(['./python/python.exe', '-I', 'get-pip.py'])
|
||||
|
||||
## Isolated mode
|
||||
We want to run in what is called isolated mode, given by the switch -I.
|
||||
This mode prevents the embedded python distribution from searching in
|
||||
This mode prevents the embedded python distribution from searching in
|
||||
global directories for imports
|
||||
|
||||
For example, if a user has `C:\Python37` and the embedded distribution is
|
||||
|
@ -66,7 +66,7 @@ def proxy_site(env, start_response, video=False):
|
||||
# such as 8192 lest that causes the socket library to limit the
|
||||
# TCP window size
|
||||
# Might need fine-tuning, since this gives us 4*65536
|
||||
# The tradeoff is that larger values (such as 6 seconds) only
|
||||
# The tradeoff is that larger values (such as 6 seconds) only
|
||||
# allows video to buffer in those increments, meaning user must wait
|
||||
# until the entire chunk is downloaded before video starts playing
|
||||
content_part = response.read(32*8192)
|
||||
@ -95,9 +95,9 @@ def split_url(url):
|
||||
match = re.match(r'(?:https?://)?([\w-]+(?:\.[\w-]+)+?)(/.*|$)', url)
|
||||
if match is None:
|
||||
raise ValueError('Invalid or unsupported url: ' + url)
|
||||
|
||||
|
||||
return match.group(1), match.group(2)
|
||||
|
||||
|
||||
|
||||
|
||||
def error_code(code, start_response):
|
||||
|
@ -134,7 +134,7 @@ For security reasons, enabling this is not recommended.''',
|
||||
'default': True,
|
||||
'comment': '',
|
||||
}),
|
||||
|
||||
|
||||
('use_comments_js', {
|
||||
'label': 'Enable comments.js',
|
||||
'type': bool,
|
||||
|
@ -155,7 +155,7 @@ def get_delete_comment_page():
|
||||
def get_post_comment_page():
|
||||
video_id = request.args['video_id']
|
||||
parent_id = request.args.get('parent_id', '')
|
||||
|
||||
|
||||
if parent_id: # comment reply
|
||||
form_action = util.URL_ORIGIN + '/comments?parent_id=' + parent_id + "&video_id=" + video_id
|
||||
replying = True
|
||||
|
@ -5,13 +5,13 @@ import io
|
||||
def byte(n):
|
||||
return bytes((n,))
|
||||
|
||||
|
||||
|
||||
def varint_encode(offset):
|
||||
'''In this encoding system, for each 8-bit byte, the first bit is 1 if there are more bytes, and 0 is this is the last one.
|
||||
The next 7 bits are data. These 7-bit sections represent the data in Little endian order. For example, suppose the data is
|
||||
aaaaaaabbbbbbbccccccc (each of these sections is 7 bits). It will be encoded as:
|
||||
1ccccccc 1bbbbbbb 0aaaaaaa
|
||||
|
||||
|
||||
This encoding is used in youtube parameters to encode offsets and to encode the length for length-prefixed data.
|
||||
See https://developers.google.com/protocol-buffers/docs/encoding#varints for more info.'''
|
||||
needed_bytes = ceil(offset.bit_length()/7) or 1 # (0).bit_length() returns 0, but we need 1 in that case.
|
||||
@ -20,20 +20,20 @@ def varint_encode(offset):
|
||||
encoded_bytes[i] = (offset & 127) | 128 # 7 least significant bits
|
||||
offset = offset >> 7
|
||||
encoded_bytes[-1] = offset & 127 # leave first bit as zero for last byte
|
||||
|
||||
|
||||
return bytes(encoded_bytes)
|
||||
|
||||
|
||||
|
||||
def varint_decode(encoded):
|
||||
decoded = 0
|
||||
for i, byte in enumerate(encoded):
|
||||
decoded |= (byte & 127) << 7*i
|
||||
|
||||
|
||||
if not (byte & 128):
|
||||
break
|
||||
return decoded
|
||||
|
||||
|
||||
|
||||
def string(field_number, data):
|
||||
data = as_bytes(data)
|
||||
return _proto_field(2, field_number, varint_encode(len(data)) + data)
|
||||
@ -41,20 +41,20 @@ nested = string
|
||||
|
||||
def uint(field_number, value):
|
||||
return _proto_field(0, field_number, varint_encode(value))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def _proto_field(wire_type, field_number, data):
|
||||
''' See https://developers.google.com/protocol-buffers/docs/encoding#structure '''
|
||||
return varint_encode( (field_number << 3) | wire_type) + data
|
||||
|
||||
|
||||
|
||||
|
||||
def percent_b64encode(data):
|
||||
return base64.urlsafe_b64encode(data).replace(b'=', b'%3D')
|
||||
|
||||
|
||||
|
||||
|
||||
def unpadded_b64encode(data):
|
||||
return base64.urlsafe_b64encode(data).replace(b'=', b'')
|
||||
|
||||
@ -81,7 +81,7 @@ def read_varint(data):
|
||||
i += 1
|
||||
return result
|
||||
|
||||
|
||||
|
||||
def read_group(data, end_sequence):
|
||||
start = data.tell()
|
||||
index = data.original.find(end_sequence, start)
|
||||
@ -101,7 +101,7 @@ def read_protobuf(data):
|
||||
break
|
||||
wire_type = tag & 7
|
||||
field_number = tag >> 3
|
||||
|
||||
|
||||
if wire_type == 0:
|
||||
value = read_varint(data)
|
||||
elif wire_type == 1:
|
||||
|
@ -1,4 +1,4 @@
|
||||
.video-metadata{
|
||||
.video-metadata{
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
grid-template-rows: auto auto 1fr auto;
|
||||
|
@ -34,11 +34,11 @@
|
||||
main .channel-tabs{
|
||||
grid-row:2;
|
||||
grid-column: 1 / span 2;
|
||||
|
||||
|
||||
display:grid;
|
||||
grid-auto-flow: column;
|
||||
justify-content:start;
|
||||
|
||||
|
||||
background-color: var(--interface-color);
|
||||
padding: 3px;
|
||||
padding-left: 6px;
|
||||
@ -103,7 +103,7 @@
|
||||
}
|
||||
{% endblock style %}
|
||||
|
||||
{% block main %}
|
||||
{% block main %}
|
||||
<img class="avatar" src="{{ avatar }}">
|
||||
<div class="summary">
|
||||
<h2 class="title">{{ channel_name }}</h2>
|
||||
|
@ -25,7 +25,7 @@
|
||||
}
|
||||
{% endblock style %}
|
||||
|
||||
{% block main %}
|
||||
{% block main %}
|
||||
<div class="playlist-metadata">
|
||||
<h2 class="playlist-title">{{ playlist_name }}</h2>
|
||||
<input type="hidden" name="playlist_page" value="{{ playlist_name }}" form="playlist-edit">
|
||||
|
@ -6,7 +6,7 @@
|
||||
width: 800px;
|
||||
margin:auto;
|
||||
}
|
||||
|
||||
|
||||
.playlist-metadata{
|
||||
display:grid;
|
||||
grid-template-columns: 0fr 1fr;
|
||||
@ -44,7 +44,7 @@
|
||||
display: grid;
|
||||
grid-auto-rows: 0fr;
|
||||
grid-row-gap: 10px;
|
||||
|
||||
|
||||
}
|
||||
{% endblock style %}
|
||||
|
||||
@ -61,7 +61,7 @@
|
||||
<div class="playlist-description">{{ common_elements.text_runs(description) }}</div>
|
||||
</div>
|
||||
|
||||
<div id="results">
|
||||
<div id="results">
|
||||
{% for info in video_list %}
|
||||
{{ common_elements.item(info) }}
|
||||
{% endfor %}
|
||||
|
@ -19,10 +19,10 @@ body{
|
||||
margin:0;
|
||||
padding: 0;
|
||||
color:var(--text-color);
|
||||
|
||||
|
||||
|
||||
|
||||
background-color:var(--background-color);
|
||||
|
||||
|
||||
min-height:100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@ -141,7 +141,7 @@ body{
|
||||
.item-list{
|
||||
display: grid;
|
||||
grid-row-gap: 10px;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -164,7 +164,7 @@ body{
|
||||
.item-box{
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
/* prevent overflow due to long titles with no spaces:
|
||||
/* prevent overflow due to long titles with no spaces:
|
||||
https://stackoverflow.com/a/43312314 */
|
||||
min-width: 0;
|
||||
}
|
||||
@ -185,7 +185,7 @@ body{
|
||||
align-content: start;
|
||||
grid-template-columns: auto 1fr;
|
||||
grid-template-rows: auto auto auto auto 1fr;
|
||||
/* prevent overflow due to long titles with no spaces:
|
||||
/* prevent overflow due to long titles with no spaces:
|
||||
https://stackoverflow.com/a/43312314 */
|
||||
min-width: 0;
|
||||
}
|
||||
@ -308,7 +308,7 @@ body{
|
||||
justify-content: center;
|
||||
display: grid;
|
||||
grid-auto-columns: 40px;
|
||||
grid-auto-flow: column;
|
||||
grid-auto-flow: column;
|
||||
height: 40px;
|
||||
}
|
||||
.next-previous-button-row{
|
||||
|
@ -295,7 +295,7 @@ def extract_item_info(item, additional_info={}):
|
||||
info['duration'] = extract_str(item.get('lengthText'))
|
||||
|
||||
# if it's an item in a playlist, get its index
|
||||
if 'index' in item: # url has wrong index on playlist page
|
||||
if 'index' in item: # url has wrong index on playlist page
|
||||
info['index'] = extract_int(item.get('index'))
|
||||
elif 'indexText' in item:
|
||||
# Current item in playlist has ▶ instead of the actual index, must
|
||||
|
@ -164,7 +164,7 @@ def extract_playlist_metadata(polymer_json):
|
||||
metadata['video_count'] = extract_int(header.get('numVideosText'))
|
||||
metadata['description'] = extract_str(header.get('descriptionText'), default='')
|
||||
metadata['author'] = extract_str(header.get('ownerText'))
|
||||
metadata['author_id'] = multi_deep_get(header,
|
||||
metadata['author_id'] = multi_deep_get(header,
|
||||
['ownerText', 'runs', 0, 'navigationEndpoint', 'browseEndpoint', 'browseId'],
|
||||
['ownerEndpoint', 'browseEndpoint', 'browseId'])
|
||||
if metadata['author_id']:
|
||||
|
@ -172,7 +172,7 @@ def _extract_watch_info_mobile(top_level):
|
||||
else:
|
||||
info['playlist'] = {}
|
||||
info['playlist']['title'] = playlist.get('title')
|
||||
info['playlist']['author'] = extract_str(multi_get(playlist,
|
||||
info['playlist']['author'] = extract_str(multi_get(playlist,
|
||||
'ownerName', 'longBylineText', 'shortBylineText', 'ownerText'))
|
||||
author_id = deep_get(playlist, 'longBylineText', 'runs', 0,
|
||||
'navigationEndpoint', 'browseEndpoint', 'browseId')
|
||||
|
Loading…
x
Reference in New Issue
Block a user