]> jfr.im git - yt-dlp.git/commitdiff
[cleanup] minor fixes
authorpukkandan <redacted>
Tue, 9 Nov 2021 22:44:42 +0000 (04:14 +0530)
committerpukkandan <redacted>
Tue, 9 Nov 2021 22:49:54 +0000 (04:19 +0530)
yt_dlp/YoutubeDL.py
yt_dlp/extractor/instagram.py
yt_dlp/extractor/vlive.py
yt_dlp/extractor/youtube.py
yt_dlp/postprocessor/__init__.py
yt_dlp/utils.py

index 7d085a33e7d34336811bdc9ff75a2a3c5519f90b..2439fc82bdb9a615096d46c0456fe4040b6b551f 100644 (file)
@@ -1539,7 +1539,7 @@ def iter_playlistitems(format):
             def get_entry(i):
                 return ie_entries[i - 1]
         else:
-            if not isinstance(ie_entries, PagedList):
+            if not isinstance(ie_entries, (PagedList, LazyList)):
                 ie_entries = LazyList(ie_entries)
 
             def get_entry(i):
@@ -3374,13 +3374,13 @@ def python_implementation():
         from .postprocessor.embedthumbnail import has_mutagen
         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],
-            has_websockets and 'websockets',
+            KEYRING_AVAILABLE and 'keyring',
             has_mutagen and 'mutagen',
             SQLITE_AVAILABLE and 'sqlite',
-            KEYRING_AVAILABLE and 'keyring',
-        )))) or 'none'
+            has_websockets and 'websockets',
+            delim=', ') or 'none'
         write_debug('Optional libraries: %s' % lib_str)
 
         proxy_map = {}
index 4694c9a33bbe935a373c9970c341af34d0281d62..0e726423e070e5529375a811f34bab494038de32 100644 (file)
@@ -74,6 +74,7 @@ def _real_initialize(self):
 
 
 class InstagramIOSIE(InfoExtractor):
+    IE_DESC = 'IOS instagram:// URL'
     _VALID_URL = r'instagram://media\?id=(?P<id>[\d_]+)'
     _TESTS = [{
         'url': 'instagram://media?id=482584233761418119',
@@ -241,7 +242,7 @@ def _real_extract(self, url):
         if 'www.instagram.com/accounts/login' in urlh.geturl().rstrip('/'):
             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,
          width) = [None] * 12
 
@@ -366,8 +367,8 @@ def get_count(keys, kind):
             if description is not None:
                 description = lowercase_escape(description)
 
-        if not thumbnail:
-            thumbnail = self._og_search_thumbnail(webpage)
+        if not thumbnails:
+            thumbnails = self._og_search_thumbnail(webpage)
 
         return {
             'id': video_id,
index 4340b1d4c9d4e11ec9c62f04d8e5acc84f2e669a..8fccf1b63b1523fefefbf47a98b8c603e67f2cc5 100644 (file)
@@ -12,6 +12,7 @@
 from ..utils import (
     ExtractorError,
     int_or_none,
+    LazyList,
     merge_dicts,
     str_or_none,
     strip_or_none,
@@ -363,11 +364,10 @@ def _real_extract(self, url):
             if board.get('boardType') not in ('STAR', 'VLIVE_PLUS'):
                 raise ExtractorError(f'Board {board_name!r} is not supported', expected=True)
 
-        entries = self._entries(posts_id or channel_id, board_name)
-        first_video = next(entries)
-        channel_name = first_video['channel']
+        entries = LazyList(self._entries(posts_id or channel_id, board_name))
+        channel_name = entries[0]['channel']
 
         return self.playlist_result(
-            itertools.chain([first_video], entries),
+            entries,
             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)
index 25554c8625ad221d9fba4059bcc19b3b218cd4f7..7bcd6e7dc693a914c0f0fc57de99409e5b5fc477 100644 (file)
@@ -4429,7 +4429,7 @@ class YoutubeYtUserIE(InfoExtractor):
     def _real_extract(self, url):
         user_id = self._match_id(url)
         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)
 
 
index 07c87b76a816102dd824f3cb892edf49dc00997d..4ae230d2f2ef0c598ec85f74cd138428c860f179 100644 (file)
@@ -2,6 +2,7 @@
 
 from ..utils import load_plugins
 
+from .common import PostProcessor
 from .embedthumbnail import EmbedThumbnailPP
 from .exec import ExecPP, ExecAfterDownloadPP
 from .ffmpeg import (
@@ -39,5 +40,5 @@ def get_postprocessor(key):
     return globals()[key + 'PP']
 
 
-__all__ = [name for name in globals().keys() if name.endswith('IE')]
-__all__.append('FFmpegPostProcessor')
+__all__ = [name for name in globals().keys() if name.endswith('PP')]
+__all__.extend(('PostProcessor', 'FFmpegPostProcessor'))
index cd453f36759fa4952cc3575a0d78d0470189fd66..f07eef61f0c8e011cb88396e99fd3b6a4650b587 100644 (file)
@@ -6586,5 +6586,5 @@ def number_of_digits(number):
 
 def join_nonempty(*values, delim='-', from_dict=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)))