[onetpl] Add support for onet.pl (closes #10507)
authorSergey M․ <dstftw@gmail.com>
Tue, 14 Feb 2017 18:14:06 +0000 (01:14 +0700)
committerSergey M․ <dstftw@gmail.com>
Tue, 14 Feb 2017 18:14:06 +0000 (01:14 +0700)
youtube_dl/extractor/extractors.py
youtube_dl/extractor/onet.py

index b2ee0c1b09a7b712caebbe50b4054e7dc77d2985..be3688d5a6f97f009e4853cbdf7a57f6d0161ad6 100644 (file)
@@ -695,6 +695,7 @@ from .onet import (
     OnetIE,
     OnetChannelIE,
     OnetMVPIE,
+    OnetPlIE,
 )
 from .onionstudios import OnionStudiosIE
 from .ooyala import (
index 46bad492a9be3636e42ff322b89b0f676f567758..801aadbffd3fe36a0923c318aa237830766f1189 100644 (file)
@@ -181,3 +181,35 @@ class OnetChannelIE(OnetBaseIE):
         channel_title = strip_or_none(get_element_by_class('o_channelName', webpage))
         channel_description = strip_or_none(get_element_by_class('o_channelDesc', webpage))
         return self.playlist_result(entries, channel_id, channel_title, channel_description)
+
+
+class OnetPlIE(InfoExtractor):
+    _VALID_URL = r'https?://(?:[^/]+\.)?onet\.pl/(?:[^/]+/)+(?P<id>[0-9a-z]+)'
+    IE_NAME = 'onet.pl'
+
+    _TESTS = [{
+        'url': 'http://eurosport.onet.pl/zimowe/skoki-narciarskie/ziobro-wygral-kwalifikacje-w-pjongczangu/9ckrly',
+        'md5': 'b94021eb56214c3969380388b6e73cb0',
+        'info_dict': {
+            'id': '1561707.1685479',
+            'ext': 'mp4',
+            'title': 'Ziobro wygrał kwalifikacje w Pjongczangu',
+            'description': 'md5:61fb0740084d2d702ea96512a03585b4',
+            'upload_date': '20170214',
+            'timestamp': 1487078046,
+        },
+    }, {
+        'url': 'http://film.onet.pl/zwiastuny/ghost-in-the-shell-drugi-zwiastun-pl/5q6yl3',
+        'only_matching': True,
+    }]
+
+    def _real_extract(self, url):
+        video_id = self._match_id(url)
+
+        webpage = self._download_webpage(url, video_id)
+
+        mvp_id = self._search_regex(
+            r'data-params-mvp=["\'](\d+\.\d+)', webpage, 'mvp id')
+
+        return self.url_result(
+            'onetmvp:%s' % mvp_id, OnetMVPIE.ie_key(), video_id=mvp_id)