mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-09-13 22:44:32 +03:00
Print page count
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import itertools
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
determine_ext,
|
determine_ext,
|
||||||
@@ -140,8 +142,8 @@ class KikaPlaylistIE(InfoExtractor):
|
|||||||
}]
|
}]
|
||||||
|
|
||||||
def _entries(self, playlist_url, playlist_id):
|
def _entries(self, playlist_url, playlist_id):
|
||||||
while playlist_url:
|
for page in itertools.count(1):
|
||||||
data = self._download_json(playlist_url, playlist_id)
|
data = self._download_json(playlist_url, playlist_id, note=f'Downloading page {page}')
|
||||||
for item in traverse_obj(data, ('content', lambda _, v: url_or_none(v['api']['url']))):
|
for item in traverse_obj(data, ('content', lambda _, v: url_or_none(v['api']['url']))):
|
||||||
yield self.url_result(
|
yield self.url_result(
|
||||||
item['api']['url'], ie=KikaIE,
|
item['api']['url'], ie=KikaIE,
|
||||||
@@ -151,8 +153,10 @@ class KikaPlaylistIE(InfoExtractor):
|
|||||||
'duration': ('duration', {int_or_none}),
|
'duration': ('duration', {int_or_none}),
|
||||||
'timestamp': ('date', {parse_iso8601}),
|
'timestamp': ('date', {parse_iso8601}),
|
||||||
}))
|
}))
|
||||||
# This becomes 'None' when reaching the last page
|
|
||||||
playlist_url = traverse_obj(data, ('links', 'next', {url_or_none}))
|
playlist_url = traverse_obj(data, ('links', 'next', {url_or_none}))
|
||||||
|
if not playlist_url:
|
||||||
|
break
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
playlist_id = self._match_id(url)
|
playlist_id = self._match_id(url)
|
||||||
|
|||||||
Reference in New Issue
Block a user