]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/azmedien.py
2 from __future__
import unicode_literals
7 from .common
import InfoExtractor
8 from .kaltura
import KalturaIE
11 class AZMedienIE(InfoExtractor
):
12 IE_DESC
= 'AZ Medien videos'
23 [^/]+-(?P<article_id>\d+)
34 'url': 'https://www.telezueri.ch/sonntalk/bundesrats-vakanzen-eu-rahmenabkommen-133214569',
38 'title': 'Bundesrats-Vakanzen / EU-Rahmenabkommen',
39 'description': 'md5:dd9f96751ec9c35e409a698a328402f3',
40 'uploader_id': 'TVOnline',
41 'upload_date': '20180930',
42 'timestamp': 1538328802,
45 'skip_download': True,
48 'url': 'https://www.telebaern.tv/telebaern-news/montag-1-oktober-2018-ganze-sendung-133531189#video=0_7xjo9lf1',
52 _PARTNER_ID
= '1719221'
54 def _real_extract(self
, url
):
55 mobj
= re
.match(self
._VALID
_URL
, url
)
56 video_id
= mobj
.group('id')
57 entry_id
= mobj
.group('kaltura_id')
60 webpage
= self
._download
_webpage
(url
, video_id
)
61 api_path
= self
._search
_regex
(
62 r
'["\']apiPath
["\']\s*:\s*["\']([^
"^\']+)["\']',
64 api_url = 'https
://www
.%s%s' % (mobj.group('host
'), api_path)
66 'query
': '''query VideoContext($articleId: ID!) {
67 article: node(id: $articleId) {
79 'variables
': {'articleId
': 'Article
:%s' % mobj.group('article_id
')},
81 json_data = self._download_json(
82 api_url, video_id, headers={
83 'Content
-Type
': 'application
/json
',
85 data=json.dumps(payload).encode())
86 entry_id = json_data['data
']['article
']['mainAssetRelation
']['asset
']['kalturaId
']
88 return self.url_result(
89 'kaltura
:%s:%s' % (self._PARTNER_ID, entry_id),
90 ie=KalturaIE.ie_key(), video_id=entry_id)