]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[odnoklassniki] Fix extraction and extend _VALID_URL (closes #6726)
authorYen Chi Hsuan <yan12125@gmail.com>
Tue, 1 Sep 2015 08:34:05 +0000 (16:34 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Tue, 1 Sep 2015 08:34:05 +0000 (16:34 +0800)
youtube_dl/extractor/odnoklassniki.py

index 003d27de783b926e68657f7ad8eefe9b2c75d5cf..f552e6f7e6d49dd5ba0c20b74c9520866e4ab059 100644 (file)
@@ -12,7 +12,7 @@ from ..utils import (
 
 
 class OdnoklassnikiIE(InfoExtractor):
-    _VALID_URL = r'https?://(?:odnoklassniki|ok)\.ru/(?:video|web-api/video/moviePlayer)/(?P<id>[\d-]+)'
+    _VALID_URL = r'https?://(?:www\.)?(?:odnoklassniki|ok)\.ru/(?:video|web-api/video/moviePlayer)/(?P<id>[\d-]+)'
     _TESTS = [{
         # metadata in JSON
         'url': 'http://ok.ru/video/20079905452',
@@ -46,6 +46,9 @@ class OdnoklassnikiIE(InfoExtractor):
     }, {
         'url': 'http://ok.ru/web-api/video/moviePlayer/20079905452',
         'only_matching': True,
+    }, {
+        'url': 'http://www.ok.ru/video/20648036891',
+        'only_matching': True,
     }]
 
     def _real_extract(self, url):
@@ -56,7 +59,7 @@ class OdnoklassnikiIE(InfoExtractor):
 
         player = self._parse_json(
             unescapeHTML(self._search_regex(
-                r'data-attributes="([^"]+)"', webpage, 'player')),
+                r'data-options="([^"]+)"', webpage, 'player')),
             video_id)
 
         flashvars = player['flashvars']