2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
9 compat_urllib_parse_unquote
,
18 class PolskieRadioIE(InfoExtractor
):
19 _VALID_URL
= r
'https?://(?:www\.)?polskieradio\.pl/\d+/\d+/Artykul/(?P<id>[0-9]+)'
21 'url': 'http://www.polskieradio.pl/7/5102/Artykul/1587943,Prof-Andrzej-Nowak-o-historii-nie-da-sie-myslec-beznamietnie',
24 'title': 'Prof. Andrzej Nowak: o historii nie da się myśleć beznamiętnie',
25 'description': 'md5:12f954edbf3120c5e7075e17bf9fc5c5',
28 'md5': '2984ee6ce9046d91fc233bc1a864a09a',
32 'title': 'md5:d4623290d4ac983bf924061c75c23a0d',
33 'timestamp': 1456594200,
34 'upload_date': '20160227',
39 'url': 'http://www.polskieradio.pl/265/5217/Artykul/1635803,Euro-2016-nie-ma-miejsca-na-blad-Polacy-graja-ze-Szwajcaria-o-cwiercfinal',
42 'title': 'Euro 2016: nie ma miejsca na błąd. Polacy grają ze Szwajcarią o ćwierćfinał',
43 'description': 'md5:01cb7d0cad58664095d72b51a1ebada2',
45 'playlist_mincount': 12,
47 'url': 'http://polskieradio.pl/9/305/Artykul/1632955,Bardzo-popularne-slowo-remis',
48 'only_matching': True,
50 'url': 'http://www.polskieradio.pl/7/5102/Artykul/1587943',
51 'only_matching': True,
54 'url': 'http://www.polskieradio.pl/9/299/Artykul/1634903,Brexit-Leszek-Miller-swiat-sie-nie-zawali-Europa-bedzie-trwac-dalej',
55 'only_matching': True,
58 def _real_extract(self
, url
):
59 playlist_id
= self
._match
_id
(url
)
61 webpage
= self
._download
_webpage
(url
, playlist_id
)
63 content
= self
._search
_regex
(
64 r
'(?s)<div[^>]+class="audio atarticle"[^>]*>(.+?)<script>',
67 timestamp
= unified_timestamp(self
._html
_search
_regex
(
68 r
'(?s)<span[^>]+id="datetime2"[^>]*>(.+?)</span>',
69 webpage
, 'timestamp', fatal
=False))
75 for data_media
in re
.findall(r
'<[^>]+data-media=({[^>]+})', content
):
76 media
= self
._parse
_json
(data_media
, playlist_id
, fatal
=False)
77 if not media
.get('file') or not media
.get('desc'):
79 media_url
= self
._proto
_relative
_url
(media
['file'], 'http:')
80 if media_url
in media_urls
:
82 media_urls
.add(media_url
)
84 'id': compat_str(media
['id']),
86 'title': compat_urllib_parse_unquote(media
['desc']),
87 'duration': int_or_none(media
.get('length')),
88 'vcodec': 'none' if media
.get('provider') == 'audio' else None,
89 'timestamp': timestamp
,
92 title
= self
._og
_search
_title
(webpage
).strip()
93 description
= strip_or_none(self
._og
_search
_description
(webpage
))
95 return self
.playlist_result(entries
, playlist_id
, title
, description
)