3 from .common
import InfoExtractor
11 class PearVideoIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?pearvideo\.com/video_(?P<id>\d+)'
14 'url': 'http://www.pearvideo.com/video_1076290',
18 'title': '小浣熊在主人家玻璃上滚石头:没砸',
19 'description': 'md5:01d576b747de71be0ee85eb7cac25f9d',
20 'timestamp': 1494275280,
21 'upload_date': '20170508',
25 def _real_extract(self
, url
):
26 video_id
= self
._match
_id
(url
)
28 webpage
= self
._download
_webpage
(url
, video_id
)
31 ('ldflv', 'ld', 'sdflv', 'sd', 'hdflv', 'hd', 'src'))
34 'url': mobj
.group('url'),
35 'format_id': mobj
.group('id'),
36 'quality': quality(mobj
.group('id')),
37 } for mobj
in re
.finditer(
38 r
'(?P<id>[a-zA-Z]+)Url\s*=\s*(["\'])(?P
<url
>(?
:https?
:)?
//.+?
)\
2',
41 info = self._download_json(
42 'https
://www
.pearvideo
.com
/videoStatus
.jsp
', video_id=video_id,
43 query={'contId
': video_id}, headers={'Referer
': url})
46 'url
': v.replace(info['systemTime
'], f'cont
-{video_id}
') if k == 'srcUrl
' else v,
47 } for k, v in traverse_obj(info, ('videoInfo
', 'videos
'), default={}).items() if v]
49 title = self._search_regex(
50 (r'<h1
[^
>]+\bclass
=(["\'])video-tt\1[^>]*>(?P<value>[^<]+)',
51 r'<[^>]+\bdata-title=(["\'])(?P
<value
>(?
:(?
!\
1).)+)\
1'),
52 webpage, 'title
', group='value
')
53 description = self._search_regex(
54 (r'<div
[^
>]+\bclass
=(["\'])summary\1[^>]*>(?P<value>[^<]+)',
55 r'<[^>]+\bdata-summary=(["\'])(?P
<value
>(?
:(?
!\
1).)+)\
1'),
56 webpage, 'description
', default=None,
57 group='value
') or self._html_search_meta('Description
', webpage)
58 timestamp = unified_timestamp(self._search_regex(
59 r'<div
[^
>]+\bclass
=["\']date["\'][^
>]*>([^
<]+)',
60 webpage, 'timestamp
', fatal=False))
65 'description
': description,
66 'timestamp
': timestamp,