]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/zippcast.py
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
  12 class ZippCastIE(InfoExtractor
): 
  13     _VALID_URL 
= r
'https?://(?:www\.)?zippcast\.com/(?:video/|videoview\.php\?.*\bvplay=)(?P<id>[0-9a-zA-Z]+)' 
  15         # m3u8, hq direct link 
  16         'url': 'http://www.zippcast.com/video/c9cfd5c7e44dbc29c81', 
  17         'md5': '5ea0263b5606866c4d6cda0fc5e8c6b6', 
  19             'id': 'c9cfd5c7e44dbc29c81', 
  21             'title': '[Vinesauce] Vinny - Digital Space Traveler', 
  22             'description': 'Muted on youtube, but now uploaded in it\'s original form.', 
  23             'thumbnail': 're:^https?://.*\.jpg$', 
  24             'uploader': 'vinesauce', 
  26             'categories': ['Entertainment'], 
  30         # f4m, lq ipod direct link 
  31         'url': 'http://www.zippcast.com/video/b79c0a233e9c6581775', 
  32         'only_matching': True, 
  34         'url': 'http://www.zippcast.com/videoview.php?vplay=c9cfd5c7e44dbc29c81&auto=no', 
  35         'only_matching': True, 
  38     def _real_extract(self
, url
): 
  39         video_id 
= self
._match
_id
(url
) 
  41         webpage 
= self
._download
_webpage
( 
  42             'http://www.zippcast.com/video/%s' % video_id
, video_id
) 
  45         video_url 
= self
._search
_regex
( 
  46             r
'<source[^>]+src=(["\'])(?P
<url
>.+?
)\
1', webpage, 
  47             'video url
', default=None, group='url
') 
  52                 'preference
': 0,  # direct link is almost always of worse quality 
  54         src_url = self._search_regex( 
  55             r'src\s
*:\s
*(?
:escape\
()?
(["\'])(?P<url>http://.+?)\1', 
  56             webpage, 'src', default=None, group='url') 
  57         ext = determine_ext(src_url) 
  59             formats.extend(self._extract_m3u8_formats( 
  60                 src_url, video_id, 'mp4', entry_protocol='m3u8_native', 
  61                 m3u8_id='hls', fatal=False)) 
  63             formats.extend(self._extract_f4m_formats( 
  64                 src_url, video_id, f4m_id='hds', fatal=False)) 
  65         self._sort_formats(formats) 
  67         title = self._og_search_title(webpage) 
  68         description = self._og_search_description(webpage) or self._html_search_meta( 
  69             'description', webpage) 
  70         uploader = self._search_regex( 
  71             r'<a[^>]+href="https?
://[^
/]+/profile
/[^
>]+>([^
<]+)</a
>', 
  72             webpage, 'uploader
', fatal=False) 
  73         thumbnail = self._og_search_thumbnail(webpage) 
  74         view_count = str_to_int(self._search_regex( 
  75             r'>([\d
,.]+) views
!', webpage, 'view count
', fatal=False)) 
  77         categories = re.findall( 
  78             r'<a
[^
>]+href
="https?://[^/]+/categories/[^"]+">([^<]+),?<', 
  81             r'<a[^>]+href="https?
://[^
/]+/search
/tags
/[^
"]+">([^
<]+),?
<', 
  87             'description
': description, 
  88             'thumbnail
': thumbnail, 
  90             'view_count
': view_count, 
  91             'categories
': categories,