mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-05 01:38:36 +01:00
[ie/Newgrounds:user] Fix extractor (#9046)
Closes #7308 Authored by: u-spec-png
This commit is contained in:
parent
9f1e9dab21
commit
3e083191cd
|
@ -3,15 +3,15 @@
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
OnDemandPagedList,
|
||||||
clean_html,
|
clean_html,
|
||||||
extract_attributes,
|
extract_attributes,
|
||||||
get_element_by_id,
|
get_element_by_id,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
parse_count,
|
parse_count,
|
||||||
parse_duration,
|
parse_duration,
|
||||||
|
traverse_obj,
|
||||||
unified_timestamp,
|
unified_timestamp,
|
||||||
OnDemandPagedList,
|
|
||||||
try_get,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -263,15 +263,12 @@ class NewgroundsUserIE(InfoExtractor):
|
||||||
def _fetch_page(self, channel_id, url, page):
|
def _fetch_page(self, channel_id, url, page):
|
||||||
page += 1
|
page += 1
|
||||||
posts_info = self._download_json(
|
posts_info = self._download_json(
|
||||||
f'{url}/page/{page}', channel_id,
|
f'{url}?page={page}', channel_id,
|
||||||
note=f'Downloading page {page}', headers={
|
note=f'Downloading page {page}', headers={
|
||||||
'Accept': 'application/json, text/javascript, */*; q = 0.01',
|
'Accept': 'application/json, text/javascript, */*; q = 0.01',
|
||||||
'X-Requested-With': 'XMLHttpRequest',
|
'X-Requested-With': 'XMLHttpRequest',
|
||||||
})
|
})
|
||||||
sequence = posts_info.get('sequence', [])
|
for post in traverse_obj(posts_info, ('items', ..., ..., {str})):
|
||||||
for year in sequence:
|
|
||||||
posts = try_get(posts_info, lambda x: x['years'][str(year)]['items'])
|
|
||||||
for post in posts:
|
|
||||||
path, media_id = self._search_regex(
|
path, media_id = self._search_regex(
|
||||||
r'<a[^>]+\bhref=["\'][^"\']+((?:portal/view|audio/listen)/(\d+))[^>]+>',
|
r'<a[^>]+\bhref=["\'][^"\']+((?:portal/view|audio/listen)/(\d+))[^>]+>',
|
||||||
post, 'url', group=(1, 2))
|
post, 'url', group=(1, 2))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user