3 from .common
import InfoExtractor
16 class PiaproIE(InfoExtractor
):
17 _NETRC_MACHINE
= 'piapro'
18 _VALID_URL
= r
'https?://piapro\.jp/(?:t|content)/(?P<id>[\w-]+)/?'
20 'url': 'https://piapro.jp/t/NXYR',
21 'md5': 'f7c0f760913fb1d44a1c45a4af793909',
26 'uploader_id': 'wowaka',
28 'description': 'http://www.nicovideo.jp/watch/sm8082467',
30 'timestamp': 1251785475,
31 'thumbnail': r
're:^https?://.*\.(?:png|jpg)$',
32 'upload_date': '20090901',
36 'note': 'There are break lines in description, mandating (?s) flag',
37 'url': 'https://piapro.jp/t/9cSd',
38 'md5': '952bb6d1e8de95050206408a87790676',
42 'title': '青に溶けた風船 / 初音ミク',
43 'description': 'md5:d395a9bd151447631a5a1460bc7f9132',
46 'timestamp': 1644030039,
47 'upload_date': '20220205',
49 'thumbnail': r
're:^https?://.*\.(?:png|jpg)$',
50 'uploader_id': 'cyankino',
53 'url': 'https://piapro.jp/content/hcw0z3a169wtemz6',
54 'only_matching': True,
56 'url': 'https://piapro.jp/t/-SO-',
57 'only_matching': True,
62 def _perform_login(self
, username
, password
):
65 '_username': username
,
66 '_password': password
,
70 self
._request
_webpage
('https://piapro.jp/login/', None)
71 urlh
= self
._request
_webpage
(
72 'https://piapro.jp/login/exe', None,
73 note
='Logging in', errnote
='Unable to log in',
74 data
=urlencode_postdata(login_form_strs
))
78 parts
= urllib
.parse
.urlparse(urlh
.url
)
83 'unable to log in: bad username or password')
84 self
._login
_status
= login_ok
86 def _real_extract(self
, url
):
87 video_id
= self
._match
_id
(url
)
88 webpage
= self
._download
_webpage
(url
, video_id
)
90 category_id
= self
._search
_regex
(r
'categoryId=(.+)">', webpage
, 'category ID')
91 if category_id
not in ('1', '2', '21', '22', '23', '24', '25'):
92 raise ExtractorError('The URL does not contain audio.', expected
=True)
94 def extract_info(name
, description
):
95 return self
._search
_regex
(rf
'{name}[::]\s*([\d\s,:/]+)\s*</p>', webpage
, description
, default
=None)
99 'title': clean_html(get_element_by_class('contents_title', webpage
)),
100 'description': clean_html(get_element_by_class('contents_description', webpage
)),
101 'uploader': clean_html(get_element_by_class('contents_creator_txt', webpage
)),
102 'uploader_id': self
._search
_regex
(
103 r
'<a\s+href="/([^"]+)"', get_element_by_class('contents_creator', webpage
), 'uploader id', default
=None),
104 'timestamp': unified_timestamp(extract_info('投稿日', 'timestamp'), False),
105 'duration': parse_duration(extract_info('長さ', 'duration')),
106 'view_count': str_to_int(extract_info('閲覧数', 'view count')),
107 'thumbnail': self
._html
_search
_meta
('twitter:image', webpage
),
108 'filesize_approx': parse_filesize((extract_info('サイズ', 'size') or '').replace(',', '')),
109 'url': self
._search
_regex
(r
'\"url\":\s*\"(.*?)\"', webpage
, 'url'),