1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-01-24 17:42:51 +08:00

[piapro] update for website changes

Temporarily drops `uploader_url` extraction
This commit is contained in:
Dimitrios Semitsoglou-Tsiapos 2019-01-20 00:00:13 +01:00
parent fb603656c9
commit 2a9492b5bf

View File

@ -20,6 +20,7 @@ test_partial = {
'upload_date': '20100116', 'upload_date': '20100116',
'uploader': 'mothy_悪', 'uploader': 'mothy_悪',
'uploader_url': r're:https?://piapro\.jp/mothy', 'uploader_url': r're:https?://piapro\.jp/mothy',
'url': 'https://cdn.piapro.jp/mp3_a/es/es7uj48x6bvcbtgy_20100116020522_audition.mp3',
} }
} }
@ -41,21 +42,20 @@ class PiaproIE(InfoExtractor):
create_date = self._search_regex(r'''createDate\s*:\s*['"]([0-9]{14})['"]''', webpage, 'create_date', fatal=False) or \ create_date = self._search_regex(r'''createDate\s*:\s*['"]([0-9]{14})['"]''', webpage, 'create_date', fatal=False) or \
self._search_regex(r'''["']https?://songle\.jp/songs/piapro\.jp.*([0-9]{14})['"]''', webpage, 'create_date') self._search_regex(r'''["']https?://songle\.jp/songs/piapro\.jp.*([0-9]{14})['"]''', webpage, 'create_date')
cls_userbar_name = get_element_by_class("userbar-name", webpage) uploader = get_element_by_class("cd_user-name", webpage)
uploader = self._search_regex(r'<a.*?>(.+?)</a>', cls_userbar_name, 'uploader', fatal=False)
try: try:
uploader_without_honorific = re.match('.+(?=さん)', uploader).group(0) uploader_without_honorific = re.match('.+(?=さん)', uploader).group(0)
except IndexError: except IndexError:
uploader_without_honorific = None uploader_without_honorific = None
return { return {
'artist': uploader_without_honorific or uploader, 'artist': uploader_without_honorific or uploader,
'description': get_element_by_class("dtl_cap", webpage), 'description': get_element_by_class("cd_dtl_cap", webpage),
'id': content_id, 'id': content_id,
'thumbnail': self._search_regex(r'(https?://c1\.piapro\.jp/timg/.+?_1440\.jpg)', webpage, 'thumbnail', fatal=False), 'thumbnail': self._search_regex(r'(https?://c1\.piapro\.jp/timg/.+?_1440\.jpg)', webpage, 'thumbnail', fatal=False),
'timestamp': int(datetime.strptime(create_date, '%Y%m%d%H%M%S').strftime("%s")), 'timestamp': int(datetime.strptime(create_date, '%Y%m%d%H%M%S').strftime("%s")),
'title': get_element_by_class("works-title", webpage) or self._html_search_regex(r'<title>[^<]*「(.*?)」<', webpage, 'title', fatal=False), 'title': get_element_by_class("works-title", webpage) or self._html_search_regex(r'<title>[^<]*「(.*?)」<', webpage, 'title', fatal=False),
'uploader': uploader_without_honorific or uploader, 'uploader': uploader_without_honorific or uploader,
'uploader_url': self._search_regex(r'<a\s+.*?href="(https?://piapro\.jp/.+?)"', cls_userbar_name, 'uploader_url', fatal=False), # 'uploader_url': self._search_regex(r'<a\s+.*?href="(https?://piapro\.jp/.+?)"', cls_userbar_name, 'uploader_url', fatal=False), # FIXME
'url': 'http://c1.piapro.jp/amp3/{}_{}_audition.mp3'.format(content_id, create_date) 'url': 'http://cdn.piapro.jp/mp3_a/{}/{}_{}_audition.mp3'.format(content_id[:2], content_id, create_date)
} }