1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-09 07:57:46 +08:00

Improve code hygiene after code review

This commit is contained in:
grefog 2019-08-26 15:44:38 -06:00
parent 184c95ced8
commit 5d3c06ba9e

View File

@ -23,6 +23,7 @@ from ..utils import (
unified_timestamp, unified_timestamp,
urlencode_postdata, urlencode_postdata,
xpath_text, xpath_text,
urljoin,
) )
@ -481,17 +482,18 @@ class NiconicoSeriesIE(InfoExtractor):
'playlist_mincount': 49, 'playlist_mincount': 49,
} }
def _real_extract(self, url): def _real_extract(self, url):
series_id = url.split('/')[-1] series_id = self._match_id(url)
webpage = self._download_webpage(url, series_id) webpage = self._download_webpage(url, series_id)
entries = re.findall(r'<a href=["\'](\/watch\/[^"\']*)', webpage) entries = re.findall(r'<a href=["\'](/watch/[^"\']+)', webpage)
entries = [{ entries = [{
'_type': 'url', '_type': 'url',
'ie_key': NiconicoIE.ie_key(), 'ie_key': NiconicoIE.ie_key(),
'url': ('https://www.nicovideo.jp%s' % entry), 'url': urljoin('https://www.nicovideo.jp', entry),
} for entry in entries] } for entry in entries]
print(entries)
return { return {
'_type': 'playlist', '_type': 'playlist',
'id': series_id, 'id': series_id,
'entries': entries, 'entries': entries,
'title': self._search_regex(r'bodyTitle">(.*?)</div>', webpage, 'title'), 'title': self._search_regex(r'bodyTitle">(.*?)</div>', webpage, 'title', fatal=False),
} }