mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-10 03:10:38 +00:00
[cleanup] minor fixes
This commit is contained in:
parent
59a7a13ef9
commit
c586f9e8de
@ -1539,7 +1539,7 @@ class YoutubeDL(object):
|
|||||||
def get_entry(i):
|
def get_entry(i):
|
||||||
return ie_entries[i - 1]
|
return ie_entries[i - 1]
|
||||||
else:
|
else:
|
||||||
if not isinstance(ie_entries, PagedList):
|
if not isinstance(ie_entries, (PagedList, LazyList)):
|
||||||
ie_entries = LazyList(ie_entries)
|
ie_entries = LazyList(ie_entries)
|
||||||
|
|
||||||
def get_entry(i):
|
def get_entry(i):
|
||||||
@ -3374,13 +3374,13 @@ class YoutubeDL(object):
|
|||||||
from .postprocessor.embedthumbnail import has_mutagen
|
from .postprocessor.embedthumbnail import has_mutagen
|
||||||
from .cookies import SQLITE_AVAILABLE, KEYRING_AVAILABLE
|
from .cookies import SQLITE_AVAILABLE, KEYRING_AVAILABLE
|
||||||
|
|
||||||
lib_str = ', '.join(sorted(filter(None, (
|
lib_str = join_nonempty(
|
||||||
compat_pycrypto_AES and compat_pycrypto_AES.__name__.split('.')[0],
|
compat_pycrypto_AES and compat_pycrypto_AES.__name__.split('.')[0],
|
||||||
has_websockets and 'websockets',
|
KEYRING_AVAILABLE and 'keyring',
|
||||||
has_mutagen and 'mutagen',
|
has_mutagen and 'mutagen',
|
||||||
SQLITE_AVAILABLE and 'sqlite',
|
SQLITE_AVAILABLE and 'sqlite',
|
||||||
KEYRING_AVAILABLE and 'keyring',
|
has_websockets and 'websockets',
|
||||||
)))) or 'none'
|
delim=', ') or 'none'
|
||||||
write_debug('Optional libraries: %s' % lib_str)
|
write_debug('Optional libraries: %s' % lib_str)
|
||||||
|
|
||||||
proxy_map = {}
|
proxy_map = {}
|
||||||
|
@ -74,6 +74,7 @@ class InstagramBaseIE(InfoExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class InstagramIOSIE(InfoExtractor):
|
class InstagramIOSIE(InfoExtractor):
|
||||||
|
IE_DESC = 'IOS instagram:// URL'
|
||||||
_VALID_URL = r'instagram://media\?id=(?P<id>[\d_]+)'
|
_VALID_URL = r'instagram://media\?id=(?P<id>[\d_]+)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'instagram://media?id=482584233761418119',
|
'url': 'instagram://media?id=482584233761418119',
|
||||||
@ -241,7 +242,7 @@ class InstagramIE(InstagramBaseIE):
|
|||||||
if 'www.instagram.com/accounts/login' in urlh.geturl().rstrip('/'):
|
if 'www.instagram.com/accounts/login' in urlh.geturl().rstrip('/'):
|
||||||
self.raise_login_required('You need to log in to access this content')
|
self.raise_login_required('You need to log in to access this content')
|
||||||
|
|
||||||
(media, video_url, description, thumbnail, timestamp, uploader,
|
(media, video_url, description, thumbnails, timestamp, uploader,
|
||||||
uploader_id, like_count, comment_count, comments, height,
|
uploader_id, like_count, comment_count, comments, height,
|
||||||
width) = [None] * 12
|
width) = [None] * 12
|
||||||
|
|
||||||
@ -366,8 +367,8 @@ class InstagramIE(InstagramBaseIE):
|
|||||||
if description is not None:
|
if description is not None:
|
||||||
description = lowercase_escape(description)
|
description = lowercase_escape(description)
|
||||||
|
|
||||||
if not thumbnail:
|
if not thumbnails:
|
||||||
thumbnail = self._og_search_thumbnail(webpage)
|
thumbnails = self._og_search_thumbnail(webpage)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
@ -12,6 +12,7 @@ from ..compat import (
|
|||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
|
LazyList,
|
||||||
merge_dicts,
|
merge_dicts,
|
||||||
str_or_none,
|
str_or_none,
|
||||||
strip_or_none,
|
strip_or_none,
|
||||||
@ -363,11 +364,10 @@ class VLiveChannelIE(VLiveBaseIE):
|
|||||||
if board.get('boardType') not in ('STAR', 'VLIVE_PLUS'):
|
if board.get('boardType') not in ('STAR', 'VLIVE_PLUS'):
|
||||||
raise ExtractorError(f'Board {board_name!r} is not supported', expected=True)
|
raise ExtractorError(f'Board {board_name!r} is not supported', expected=True)
|
||||||
|
|
||||||
entries = self._entries(posts_id or channel_id, board_name)
|
entries = LazyList(self._entries(posts_id or channel_id, board_name))
|
||||||
first_video = next(entries)
|
channel_name = entries[0]['channel']
|
||||||
channel_name = first_video['channel']
|
|
||||||
|
|
||||||
return self.playlist_result(
|
return self.playlist_result(
|
||||||
itertools.chain([first_video], entries),
|
entries,
|
||||||
f'{channel_id}-{posts_id}' if posts_id else channel_id,
|
f'{channel_id}-{posts_id}' if posts_id else channel_id,
|
||||||
f'{channel_name} - {board_name}' if channel_name and board_name else channel_name)
|
f'{channel_name} - {board_name}' if channel_name and board_name else channel_name)
|
||||||
|
@ -4429,7 +4429,7 @@ class YoutubeYtUserIE(InfoExtractor):
|
|||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
user_id = self._match_id(url)
|
user_id = self._match_id(url)
|
||||||
return self.url_result(
|
return self.url_result(
|
||||||
'https://www.youtube.com/user/%s' % user_id,
|
'https://www.youtube.com/user/%s/videos' % user_id,
|
||||||
ie=YoutubeTabIE.ie_key(), video_id=user_id)
|
ie=YoutubeTabIE.ie_key(), video_id=user_id)
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
from ..utils import load_plugins
|
from ..utils import load_plugins
|
||||||
|
|
||||||
|
from .common import PostProcessor
|
||||||
from .embedthumbnail import EmbedThumbnailPP
|
from .embedthumbnail import EmbedThumbnailPP
|
||||||
from .exec import ExecPP, ExecAfterDownloadPP
|
from .exec import ExecPP, ExecAfterDownloadPP
|
||||||
from .ffmpeg import (
|
from .ffmpeg import (
|
||||||
@ -39,5 +40,5 @@ def get_postprocessor(key):
|
|||||||
return globals()[key + 'PP']
|
return globals()[key + 'PP']
|
||||||
|
|
||||||
|
|
||||||
__all__ = [name for name in globals().keys() if name.endswith('IE')]
|
__all__ = [name for name in globals().keys() if name.endswith('PP')]
|
||||||
__all__.append('FFmpegPostProcessor')
|
__all__.extend(('PostProcessor', 'FFmpegPostProcessor'))
|
||||||
|
@ -6586,5 +6586,5 @@ def number_of_digits(number):
|
|||||||
|
|
||||||
def join_nonempty(*values, delim='-', from_dict=None):
|
def join_nonempty(*values, delim='-', from_dict=None):
|
||||||
if from_dict is not None:
|
if from_dict is not None:
|
||||||
values = operator.itemgetter(values)(from_dict)
|
values = map(from_dict.get, values)
|
||||||
return delim.join(map(str, filter(None, values)))
|
return delim.join(map(str, filter(None, values)))
|
||||||
|
Loading…
Reference in New Issue
Block a user