]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/lecture2go.py
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
  15 class Lecture2GoIE(InfoExtractor
): 
  16     _VALID_URL 
= r
'https?://lecture2go\.uni-hamburg\.de/veranstaltungen/-/v/(?P<id>\d+)' 
  18         'url': 'https://lecture2go.uni-hamburg.de/veranstaltungen/-/v/17473', 
  19         'md5': 'ac02b570883020d208d405d5a3fd2f7f', 
  23             'title': '2 - Endliche Automaten und reguläre Sprachen', 
  24             'creator': 'Frank Heitmann', 
  29             'skip_download': True, 
  33     def _real_extract(self
, url
): 
  34         video_id 
= self
._match
_id
(url
) 
  35         webpage 
= self
._download
_webpage
(url
, video_id
) 
  37         title 
= self
._html
_search
_regex
(r
'<em[^>]+class="title">(.+)</em>', webpage
, 'title') 
  40         for url 
in set(re
.findall(r
'var\s+playerUri\d+\s*=\s*"([^"]+)"', webpage
)): 
  41             ext 
= determine_ext(url
) 
  42             protocol 
= determine_protocol({'url': url
}) 
  44                 formats
.extend(self
._extract
_f
4m
_formats
(url
, video_id
, f4m_id
='hds')) 
  46                 formats
.extend(self
._extract
_m
3u8_formats
(url
, video_id
, ext
='mp4', m3u8_id
='hls')) 
  48                 if protocol 
== 'rtmp': 
  49                     continue  # XXX: currently broken 
  51                     'format_id': protocol
, 
  55         self
._sort
_formats
(formats
) 
  57         creator 
= self
._html
_search
_regex
( 
  58             r
'<div[^>]+id="description">([^<]+)</div>', webpage
, 'creator', fatal
=False) 
  59         duration 
= parse_duration(self
._html
_search
_regex
( 
  60             r
'Duration:\s*</em>\s*<em[^>]*>([^<]+)</em>', webpage
, 'duration', fatal
=False)) 
  61         view_count 
= int_or_none(self
._html
_search
_regex
( 
  62             r
'Views:\s*</em>\s*<em[^>]+>(\d+)</em>', webpage
, 'view count', fatal
=False)) 
  70             'view_count': view_count
,