]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/discoverynetworks.py
fba1ef22180a6f4adf93c83e23d8370b6da87c56
2 from __future__
import unicode_literals
6 from .brightcove
import BrightcoveLegacyIE
7 from .dplay
import DPlayIE
12 from ..utils
import smuggle_url
15 class DiscoveryNetworksDeIE(DPlayIE
):
16 _VALID_URL
= r
'''(?x)https?://(?:www\.)?(?P<site>discovery|tlc|animalplanet|dmax)\.de/
19 (?:[^/]+/)*videos/(?P<display_id>[^/?#]+)|
20 programme/(?P<programme>[^/]+)/video/(?P<alternate_id>[^/]+)
24 'url': 'http://www.tlc.de/sendungen/breaking-amish/videos/#3235167922001',
26 'id': '3235167922001',
28 'title': 'Breaking Amish: Die Welt da draußen',
30 'Vier Amische und eine Mennonitin wagen in New York'
31 ' den Sprung in ein komplett anderes Leben. Begleitet sie auf'
32 ' ihrem spannenden Weg.'),
33 'timestamp': 1396598084,
34 'upload_date': '20140404',
35 'uploader_id': '1659832546',
38 'url': 'http://www.dmax.de/programme/storage-hunters-uk/videos/storage-hunters-uk-episode-6/',
39 'only_matching': True,
41 'url': 'http://www.discovery.de/#5332316765001',
42 'only_matching': True,
44 BRIGHTCOVE_URL_TEMPLATE
= 'http://players.brightcove.net/1659832546/default_default/index.html?videoId=%s'
46 def _real_extract(self
, url
):
47 mobj
= re
.match(self
._VALID
_URL
, url
)
48 alternate_id
= mobj
.group('alternate_id')
50 self
._initialize
_geo
_bypass
({
53 return self
._get
_disco
_api
_info
(
54 url
, '%s/%s' % (mobj
.group('programme'), alternate_id
),
55 'sonic-eu1-prod.disco-api.com', mobj
.group('site') + 'de')
56 brightcove_id
= mobj
.group('id')
58 title
= mobj
.group('title')
59 webpage
= self
._download
_webpage
(url
, title
)
60 brightcove_legacy_url
= BrightcoveLegacyIE
._extract
_brightcove
_url
(webpage
)
61 brightcove_id
= compat_parse_qs(compat_urlparse
.urlparse(
62 brightcove_legacy_url
).query
)['@videoPlayer'][0]
63 return self
.url_result(smuggle_url(
64 self
.BRIGHTCOVE_URL_TEMPLATE
% brightcove_id
, {'geo_countries': ['DE']}),
65 'BrightcoveNew', brightcove_id
)