Indicate if video is unlisted

This commit is contained in:
James Taylor 2018-08-14 02:39:05 -07:00
parent 377749d79d
commit 9cb1732904
4 changed files with 29 additions and 11 deletions

View File

@ -111,7 +111,7 @@ address{
display:grid; display:grid;
grid-template-columns:40px auto auto auto 1fr; grid-template-columns:40px auto auto auto 1fr;
grid-template-rows: 1fr; grid-template-rows: 1fr;
width: 550px; width: 540px;
} }
#playlist-edit{ #playlist-edit{
display:contents; display:contents;
@ -192,30 +192,40 @@ address{
grid-row:2; grid-row:2;
min-width: 0; min-width: 0;
} }
.full-item .is-unlisted{
background-color: #d0d0d0;
justify-self:start;
padding-left:2px;
padding-right:2px;
}
.full-item address{ .full-item address{
grid-column: 1; grid-column: 1;
grid-row: 3; grid-row: 4;
justify-self: start; justify-self: start;
} }
.full-item .views{ .full-item .views{
grid-column: 2; grid-column: 2;
grid-row: 3; grid-row: 4;
justify-self:end; justify-self:end;
} }
.full-item time{ .full-item time{
grid-column: 1; grid-column: 1;
grid-row: 4; grid-row: 5;
justify-self:start; justify-self:start;
} }
.full-item .likes-dislikes{ .full-item .likes-dislikes{
grid-column: 2; grid-column: 2;
grid-row: 4; grid-row: 5;
justify-self:end; justify-self:end;
} }
.full-item .download-dropdown{
grid-column:1;
grid-row: 6;
}
.full-item .checkbox{ .full-item .checkbox{
justify-self:end; justify-self:end;
grid-row: 5; grid-row: 6;
grid-column: 2; grid-column: 2;
} }
.full-item .description{ .full-item .description{
@ -225,17 +235,17 @@ address{
min-width: 0; min-width: 0;
grid-column: 1 / span 2; grid-column: 1 / span 2;
grid-row: 6; grid-row: 7;
} }
.full-item .music-list{ .full-item .music-list{
grid-row:7; grid-row:8;
grid-column: 1 / span 2; grid-column: 1 / span 2;
} }
.full-item .comments{ .full-item .comments{
grid-row: 8; grid-row: 9;
} }
.full-item .more-comments{ .full-item .more-comments{
grid-row: 9; grid-row: 10;
} }
.medium-item-box{ .medium-item-box{

View File

@ -414,5 +414,6 @@ def get_watch_page(query_string):
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,
is_unlisted = '<span class="is-unlisted">Unlisted</span>' if info['unlisted'] else '',
) )
return page return page

View File

@ -1530,6 +1530,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
def extract_view_count(v_info): def extract_view_count(v_info):
return int_or_none(try_get(v_info, lambda x: x['view_count'][0])) return int_or_none(try_get(v_info, lambda x: x['view_count'][0]))
# Is it unlisted?
unlisted = (self._search_regex('''<meta itemprop="unlisted" content="(\w*)">''', video_webpage, 'is_unlisted', default='False') == "True")
# Related videos # Related videos
related_vid_info = self._search_regex(r"""'RELATED_PLAYER_ARGS':\s*(\{.*?\})""", video_webpage, "related_player_args", default='') related_vid_info = self._search_regex(r"""'RELATED_PLAYER_ARGS':\s*(\{.*?\})""", video_webpage, "related_player_args", default='')
@ -1679,6 +1681,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
if 'token' not in video_info: if 'token' not in video_info:
if 'reason' in video_info: if 'reason' in video_info:
print(video_info['reason'])
if 'The uploader has not made this video available in your country.' in video_info['reason']: if 'The uploader has not made this video available in your country.' in video_info['reason']:
regions_allowed = self._html_search_meta( regions_allowed = self._html_search_meta(
'regionsAllowed', video_webpage, default=None) 'regionsAllowed', video_webpage, default=None)
@ -1936,8 +1939,10 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
formats.append(a_format) formats.append(a_format)
else: else:
error_message = extract_unavailable_message() error_message = extract_unavailable_message()
alt_error_message = clean_html(video_info.get('reason', [None])[0])
print(alt_error_message)
if not error_message: if not error_message:
error_message = clean_html(video_info.get('reason', [None])[0]) error_message = alt_error_message
if error_message: if error_message:
raise YoutubeError(error_message) raise YoutubeError(error_message)
raise ExtractorError('no conn, hlsvp or url_encoded_fmt_stream_map information found in video info') raise ExtractorError('no conn, hlsvp or url_encoded_fmt_stream_map information found in video info')
@ -2163,6 +2168,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
'artist': artist, 'artist': artist,
'related_vids': related_vids, 'related_vids': related_vids,
'music_list': music_list, 'music_list': music_list,
'unlisted': unlisted,
} }

View File

@ -105,6 +105,7 @@ $video_sources
</video> </video>
<h2 class="title">$video_title</h2> <h2 class="title">$video_title</h2>
$is_unlisted
<address>Uploaded by <a href="$uploader_channel_url">$uploader</a></address> <address>Uploaded by <a href="$uploader_channel_url">$uploader</a></address>
<span class="views">$views views</span> <span class="views">$views views</span>