[extractor/common] Fix extraction of DASH formats with the same representation id...
[youtube-dl] / youtube_dl / extractor / sportschau.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .wdr import WDRBaseIE
5 from ..utils import get_element_by_attribute
6
7
8 class SportschauIE(WDRBaseIE):
9     IE_NAME = 'Sportschau'
10     _VALID_URL = r'https?://(?:www\.)?sportschau\.de/(?:[^/]+/)+video-?(?P<id>[^/#?]+)\.html'
11     _TEST = {
12         'url': 'http://www.sportschau.de/uefaeuro2016/videos/video-dfb-team-geht-gut-gelaunt-ins-spiel-gegen-polen-100.html',
13         'info_dict': {
14             'id': 'mdb-1140188',
15             'display_id': 'dfb-team-geht-gut-gelaunt-ins-spiel-gegen-polen-100',
16             'ext': 'mp4',
17             'title': 'DFB-Team geht gut gelaunt ins Spiel gegen Polen',
18             'description': 'Vor dem zweiten Gruppenspiel gegen Polen herrscht gute Stimmung im deutschen Team. Insbesondere Bastian Schweinsteiger strotzt vor Optimismus nach seinem Tor gegen die Ukraine.',
19             'upload_date': '20160615',
20         },
21         'skip': 'Geo-restricted to Germany',
22     }
23
24     def _real_extract(self, url):
25         video_id = self._match_id(url)
26
27         webpage = self._download_webpage(url, video_id)
28         title = get_element_by_attribute('class', 'headline', webpage)
29         description = self._html_search_meta('description', webpage, 'description')
30
31         info = self._extract_wdr_video(webpage, video_id)
32
33         info.update({
34             'title': title,
35             'description': description,
36         })
37
38         return info