]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/azmedien.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
6 from .kaltura
import KalturaIE
14 class AZMedienBaseIE(InfoExtractor
):
15 def _kaltura_video(self
, partner_id
, entry_id
):
16 return self
.url_result(
17 'kaltura:%s:%s' % (partner_id
, entry_id
), ie
=KalturaIE
.ie_key(),
21 class AZMedienIE(AZMedienBaseIE
):
22 IE_DESC
= 'AZ Medien videos'
33 /[0-9]+-episode-[^/\#]+
35 /[0-9]+-segment-(?:[^/\#]+\#)?|
45 'url': 'http://www.telezueri.ch/62-show-zuerinews/13772-episode-sonntag-18-dezember-2016/32419-segment-massenabweisungen-beim-hiltl-club-wegen-pelzboom',
49 'title': 'Massenabweisungen beim Hiltl Club wegen Pelzboom',
50 'description': 'md5:9ea9dd1b159ad65b36ddcf7f0d7c76a8',
51 'uploader_id': 'TeleZ?ri',
52 'upload_date': '20161218',
53 'timestamp': 1482084490,
56 'skip_download': True,
59 # URL with 'segment' and fragment:
60 'url': 'http://www.telebaern.tv/118-show-news/14240-episode-dienstag-17-januar-2017/33666-segment-achtung-gefahr#zu-wenig-pflegerinnen-und-pfleger',
63 # URL with 'episode' and fragment:
64 'url': 'http://www.telem1.ch/47-show-sonntalk/13986-episode-soldaten-fuer-grenzschutz-energiestrategie-obama-bilanz#soldaten-fuer-grenzschutz-energiestrategie-obama-bilanz',
67 # URL with 'show' and fragment:
68 'url': 'http://www.telezueri.ch/66-show-sonntalk#burka-plakate-trump-putin-china-besuch',
72 def _real_extract(self
, url
):
73 video_id
= self
._match
_id
(url
)
75 webpage
= self
._download
_webpage
(url
, video_id
)
77 partner_id
= self
._search
_regex
(
78 r
'<script[^>]+src=["\'](?
:https?
:)?
//(?
:[^
/]+\
.)?kaltura\
.com(?
:/[^
/]+)*/(?
:p|partner_id
)/([0-9]+)',
79 webpage, 'kaltura partner
id')
80 entry_id = self._html_search_regex(
81 r'<a
[^
>]+data
-id=(["\'])(?P<id>(?:(?!\1).)+)\1[^>]+data-slug=["\']%s'
82 % re.escape(video_id), webpage, 'kaltura entry
id', group='id')
84 return self._kaltura_video(partner_id, entry_id)
87 class AZMedienPlaylistIE(AZMedienBaseIE):
88 IE_DESC = 'AZ Medien playlists
'
104 /[0-9]+-episode-[^/\#]+
111 'url
': 'http
://www
.telebaern
.tv
/118-show
-news
/13735-episode
-donnerstag
-15-dezember
-2016',
113 'id': '118-show
-news
/13735-episode
-donnerstag
-15-dezember
-2016',
114 'title
': 'News
- Donnerstag
, 15. Dezember
2016',
119 'url
': 'http
://www
.telem1
.ch
/258-themen
-tele
-m1
-classics
',
121 'id': '258-themen
-tele
-m1
-classics
',
122 'title
': 'Tele M1 Classics
',
124 'playlist_mincount
': 15,
126 # URL with 'topic
', contains nested playlists
127 'url
': 'http
://www
.telezueri
.ch
/219-topic
-aera
-trump
-hat
-offiziell
-begonnen
',
128 'only_matching
': True,
130 # URL with 'show
' only
131 'url
': 'http
://www
.telezueri
.ch
/86-show
-talktaeglich
',
132 'only_matching
': True
135 def _real_extract(self, url):
136 show_id = self._match_id(url)
137 webpage = self._download_webpage(url, show_id)
141 partner_id = self._search_regex(
142 r'src
=["\'](?:https?:)?//(?:[^/]+\.)kaltura\.com/(?:[^/]+/)*(?:p|partner_id)/(\d+)',
143 webpage, 'kaltura partner id', default=None)
147 self._kaltura_video(partner_id, m.group('id'))
148 for m in re.finditer(
149 r'data-id=(["\'])(?P
<id>(?
:(?
!\
1).)+)\
1', webpage)]
153 self.url_result(m.group('url
'), ie=AZMedienIE.ie_key())
154 for m in re.finditer(
155 r'<a
[^
>]+data
-real
=(["\'])(?P<url>http.+?)\1', webpage)]
159 # May contain nested playlists (e.g. [1]) thus no explicit
161 # 1. http://www.telezueri.ch/219-topic-aera-trump-hat-offiziell-begonnen)
162 self.url_result(urljoin(url, m.group('url')))
163 for m in re.finditer(
164 r'<a[^>]+name=[^>]+href=(["\'])(?P
<url
>/.+?
)\
1', webpage)]
166 title = self._search_regex(
167 r'episodeShareTitle\s
*=\s
*(["\'])(?P<title>(?:(?!\1).)+)\1',
169 default=strip_or_none(get_element_by_id(
170 'video-title', webpage)), group='title')
172 return self.playlist_result(entries, show_id, title)