summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-12-23 03:44:47 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2013-12-23 03:44:47 +0100
commit7dbf5ae5877e6226bd843c4f20675044b9981c00 (patch)
treee0c70eef1e6e1d129952cf3943f1a51083dfe185
parent8d0bdeba18962688f1fadfc246c69da5ad17a237 (diff)
downloadyoutube-dl-7dbf5ae5877e6226bd843c4f20675044b9981c00.tar.gz
youtube-dl-7dbf5ae5877e6226bd843c4f20675044b9981c00.tar.xz
youtube-dl-7dbf5ae5877e6226bd843c4f20675044b9981c00.zip
[smotri] Add support for moderated (?) videos (Fixes #2030)
-rw-r--r--youtube_dl/extractor/smotri.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/youtube_dl/extractor/smotri.py b/youtube_dl/extractor/smotri.py
index 51aa244e9..beea58d63 100644
--- a/youtube_dl/extractor/smotri.py
+++ b/youtube_dl/extractor/smotri.py
@@ -1,5 +1,6 @@
 # encoding: utf-8
 
+import os.path
 import re
 import json
 import hashlib
@@ -10,6 +11,7 @@ from ..utils import (
     compat_urllib_parse,
     compat_urllib_request,
     ExtractorError,
+    url_basename,
 )
 
 
@@ -132,7 +134,16 @@ class SmotriIE(InfoExtractor):
         # We will extract some from the video web page instead
         video_page_url = 'http://' + mobj.group('url')
         video_page = self._download_webpage(video_page_url, video_id, u'Downloading video page')
-        
+
+        # Warning if video is unavailable
+        warning = self._html_search_regex(
+            r'<div class="videoUnModer">(.*?)</div>', video_page,
+            u'warning messagef', default=None)
+        if warning is not None:
+            self._downloader.report_warning(
+                u'Video %s may not be available; smotri said: %s ' %
+                (video_id, warning))
+
         # Adult content
         if re.search(u'EroConfirmText">', video_page) is not None:
             self.report_age_confirmation()
@@ -148,7 +159,7 @@ class SmotriIE(InfoExtractor):
         # Extract the rest of meta data
         video_title = self._search_meta(u'name', video_page, u'title')
         if not video_title:
-            video_title = video_url.rsplit('/', 1)[-1]
+            video_title = os.path.splitext(url_basename(video_url))[0]
 
         video_description = self._search_meta(u'description', video_page)
         END_TEXT = u' на сайте Smotri.com'