mirror of https://github.com/yt-dlp/yt-dlp
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.2 KiB
Python
67 lines
2.2 KiB
Python
8 years ago
|
# coding: utf-8
|
||
8 years ago
|
from __future__ import unicode_literals
|
||
|
|
||
6 years ago
|
import json
|
||
8 years ago
|
import re
|
||
|
|
||
|
from .common import InfoExtractor
|
||
|
from .kaltura import KalturaIE
|
||
|
|
||
|
|
||
6 years ago
|
class AZMedienIE(InfoExtractor):
|
||
8 years ago
|
IE_DESC = 'AZ Medien videos'
|
||
|
_VALID_URL = r'''(?x)
|
||
|
https?://
|
||
|
(?:www\.)?
|
||
6 years ago
|
(?P<host>
|
||
8 years ago
|
telezueri\.ch|
|
||
|
telebaern\.tv|
|
||
|
telem1\.ch
|
||
|
)/
|
||
6 years ago
|
[^/]+/
|
||
|
(?P<id>
|
||
|
[^/]+-(?P<article_id>\d+)
|
||
8 years ago
|
)
|
||
6 years ago
|
(?:
|
||
|
\#video=
|
||
|
(?P<kaltura_id>
|
||
|
[_0-9a-z]+
|
||
|
)
|
||
|
)?
|
||
8 years ago
|
'''
|
||
|
|
||
|
_TESTS = [{
|
||
6 years ago
|
'url': 'https://www.telezueri.ch/sonntalk/bundesrats-vakanzen-eu-rahmenabkommen-133214569',
|
||
8 years ago
|
'info_dict': {
|
||
6 years ago
|
'id': '1_anruz3wy',
|
||
7 years ago
|
'ext': 'mp4',
|
||
6 years ago
|
'title': 'Bundesrats-Vakanzen / EU-Rahmenabkommen',
|
||
|
'uploader_id': 'TVOnline',
|
||
|
'upload_date': '20180930',
|
||
|
'timestamp': 1538328802,
|
||
8 years ago
|
},
|
||
|
'params': {
|
||
|
'skip_download': True,
|
||
|
},
|
||
|
}, {
|
||
6 years ago
|
'url': 'https://www.telebaern.tv/telebaern-news/montag-1-oktober-2018-ganze-sendung-133531189#video=0_7xjo9lf1',
|
||
8 years ago
|
'only_matching': True
|
||
|
}]
|
||
5 years ago
|
_API_TEMPL = 'https://www.%s/api/pub/gql/%s/NewsArticleTeaser/cb9f2f81ed22e9b47f4ca64ea3cc5a5d13e88d1d'
|
||
6 years ago
|
_PARTNER_ID = '1719221'
|
||
|
|
||
8 years ago
|
def _real_extract(self, url):
|
||
5 years ago
|
host, display_id, article_id, entry_id = re.match(self._VALID_URL, url).groups()
|
||
6 years ago
|
|
||
|
if not entry_id:
|
||
5 years ago
|
entry_id = self._download_json(
|
||
|
self._API_TEMPL % (host, host.split('.')[0]), display_id, query={
|
||
|
'variables': json.dumps({
|
||
|
'contextId': 'NewsArticle:' + article_id,
|
||
|
}),
|
||
|
})['data']['context']['mainAsset']['video']['kaltura']['kalturaId']
|
||
6 years ago
|
|
||
6 years ago
|
return self.url_result(
|
||
|
'kaltura:%s:%s' % (self._PARTNER_ID, entry_id),
|
||
|
ie=KalturaIE.ie_key(), video_id=entry_id)
|