projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1e1896f
)
[tvigle] Add support for cloud URLs (Closes #4887)
author
Sergey M․
<dstftw@gmail.com>
Fri, 6 Feb 2015 15:15:01 +0000
(21:15 +0600)
committer
Sergey M․
<dstftw@gmail.com>
Fri, 6 Feb 2015 15:15:01 +0000
(21:15 +0600)
youtube_dl/extractor/tvigle.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/tvigle.py
b/youtube_dl/extractor/tvigle.py
index ba65996dc01646e019cfd5820aa36c1934365d9b..102362b295450f58ff085ec9be7d21921a1ac494 100644
(file)
--- a/
youtube_dl/extractor/tvigle.py
+++ b/
youtube_dl/extractor/tvigle.py
@@
-1,6
+1,8
@@
# encoding: utf-8
from __future__ import unicode_literals
# encoding: utf-8
from __future__ import unicode_literals
+import re
+
from .common import InfoExtractor
from ..utils import (
float_or_none,
from .common import InfoExtractor
from ..utils import (
float_or_none,
@@
-11,7
+13,7
@@
from ..utils import (
class TvigleIE(InfoExtractor):
IE_NAME = 'tvigle'
IE_DESC = 'Интернет-телевидение Tvigle.ru'
class TvigleIE(InfoExtractor):
IE_NAME = 'tvigle'
IE_DESC = 'Интернет-телевидение Tvigle.ru'
- _VALID_URL = r'http
://(?:www\.)?tvigle\.ru/(?:[^/]+/)+(?P<id>[^/]+)/$
'
+ _VALID_URL = r'http
s?://(?:www\.)?(?:tvigle\.ru/(?:[^/]+/)+(?P<display_id>[^/]+)/$|cloud\.tvigle\.ru/video/(?P<id>\d+))
'
_TESTS = [
{
_TESTS = [
{
@@
-38,16
+40,22
@@
class TvigleIE(InfoExtractor):
'duration': 186.080,
'age_limit': 0,
},
'duration': 186.080,
'age_limit': 0,
},
- },
+ }, {
+ 'url': 'https://cloud.tvigle.ru/video/5267604/',
+ 'only_matching': True,
+ }
]
def _real_extract(self, url):
]
def _real_extract(self, url):
-
display_id = self._match_id(
url)
-
-
webpage = self._download_webpage(url, display_id
)
+
mobj = re.match(self._VALID_URL,
url)
+ video_id = mobj.group('id')
+
display_id = mobj.group('display_id'
)
- video_id = self._html_search_regex(
- r'<li class="video-preview current_playing" id="(\d+)">', webpage, 'video id')
+ if not video_id:
+ webpage = self._download_webpage(url, display_id)
+ video_id = self._html_search_regex(
+ r'<li class="video-preview current_playing" id="(\d+)">',
+ webpage, 'video id')
video_data = self._download_json(
'http://cloud.tvigle.ru/api/play/video/%s/' % video_id, display_id)
video_data = self._download_json(
'http://cloud.tvigle.ru/api/play/video/%s/' % video_id, display_id)