]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tlc.py
d848ee1863252dbc155652c997210476c42479e4
   2 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
   6 from .brightcove 
import BrightcoveIE
 
   7 from .discovery 
import DiscoveryIE
 
   8 from ..utils 
import compat_urlparse
 
  11 class TlcIE(DiscoveryIE
): 
  13     _VALID_URL 
= r
'http://www\.tlc\.com\/[a-zA-Z0-9\-]*/[a-zA-Z0-9\-]*/videos/(?P<id>[a-zA-Z0-9\-]*)(.htm)?' 
  16         'url': 'http://www.tlc.com/tv-shows/cake-boss/videos/too-big-to-fly.htm', 
  17         'md5': 'c4038f4a9b44d0b5d74caaa64ed2a01a', 
  21             'title': 'Cake Boss: Too Big to Fly', 
  22             'description': 'Buddy has taken on a high flying task.', 
  28 class TlcDeIE(InfoExtractor
): 
  30     _VALID_URL 
= r
'http://www\.tlc\.de/sendungen/[^/]+/videos/(?P<title>[^/?]+)' 
  33         'url': 'http://www.tlc.de/sendungen/breaking-amish/videos/#3235167922001', 
  35             'id': '3235167922001', 
  37             'title': 'Breaking Amish: Die Welt da draußen', 
  38             'uploader': 'Discovery Networks - Germany', 
  39             'description': 'Vier Amische und eine Mennonitin wagen in New York' 
  40                 '  den Sprung in ein komplett anderes Leben. Begleitet sie auf' 
  41                 ' ihrem spannenden Weg.', 
  45     def _real_extract(self
, url
): 
  46         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  47         title 
= mobj
.group('title') 
  48         webpage 
= self
._download
_webpage
(url
, title
) 
  49         iframe_url 
= self
._search
_regex
( 
  50             '<iframe src="(http://www\.tlc\.de/wp-content/.+?)"', webpage
, 
  52         # Otherwise we don't get the correct 'BrightcoveExperience' element, 
  53         # example: http://www.tlc.de/sendungen/cake-boss/videos/cake-boss-cannoli-drama/ 
  54         iframe_url 
= iframe_url
.replace('.htm?', '.php?') 
  55         url_fragment 
= compat_urlparse
.urlparse(url
).fragment
 
  57             # Since the fragment is not send to the server, we always get the same iframe 
  58             iframe_url 
= re
.sub(r
'playlist=(\d+)', 'playlist=%s' % url_fragment
, iframe_url
) 
  59         iframe 
= self
._download
_webpage
(iframe_url
, title
) 
  63             'url': BrightcoveIE
._extract
_brightcove
_url
(iframe
), 
  64             'ie': BrightcoveIE
.ie_key(),