]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/pearvideo.py
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
  13 class PearVideoIE(InfoExtractor
): 
  14     _VALID_URL 
= r
'https?://(?:www\.)?pearvideo\.com/video_(?P<id>\d+)' 
  16         'url': 'http://www.pearvideo.com/video_1076290', 
  20             'title': '小浣熊在主人家玻璃上滚石头:没砸', 
  21             'description': 'md5:01d576b747de71be0ee85eb7cac25f9d', 
  22             'timestamp': 1494275280, 
  23             'upload_date': '20170508', 
  27     def _real_extract(self
, url
): 
  28         video_id 
= self
._match
_id
(url
) 
  30         webpage 
= self
._download
_webpage
(url
, video_id
) 
  33             ('ldflv', 'ld', 'sdflv', 'sd', 'hdflv', 'hd', 'src')) 
  36             'url': mobj
.group('url'), 
  37             'format_id': mobj
.group('id'), 
  38             'quality': quality(mobj
.group('id')), 
  39         } for mobj 
in re
.finditer( 
  40             r
'(?P<id>[a-zA-Z]+)Url\s*=\s*(["\'])(?P
<url
>(?
:https?
:)?
//.+?
)\
2', 
  42         self._sort_formats(formats) 
  44         title = self._search_regex( 
  45             (r'<h1
[^
>]+\bclass
=(["\'])video-tt\1[^>]*>(?P<value>[^<]+)', 
  46              r'<[^>]+\bdata-title=(["\'])(?P
<value
>(?
:(?
!\
1).)+)\
1'), 
  47             webpage, 'title
', group='value
') 
  48         description = self._search_regex( 
  49             (r'<div
[^
>]+\bclass
=(["\'])summary\1[^>]*>(?P<value>[^<]+)', 
  50              r'<[^>]+\bdata-summary=(["\'])(?P
<value
>(?
:(?
!\
1).)+)\
1'), 
  51             webpage, 'description
', default=None, 
  52             group='value
') or self._html_search_meta('Description
', webpage) 
  53         timestamp = unified_timestamp(self._search_regex( 
  54             r'<div
[^
>]+\bclass
=["\']date["\'][^
>]*>([^
<]+)', 
  55             webpage, 'timestamp
', fatal=False)) 
  60             'description
': description, 
  61             'timestamp
': timestamp,