]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[porn91] Catch daily limit error
authorYen Chi Hsuan <yan12125@gmail.com>
Sat, 30 May 2015 16:26:12 +0000 (00:26 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Sat, 30 May 2015 16:26:12 +0000 (00:26 +0800)
youtube_dl/extractor/porn91.py

index ea1efc71b2b99d94206bf4bf2a2779964be585d1..c119c7e94a6633ae12b7a36666e098086069d1d7 100644 (file)
@@ -6,6 +6,7 @@ from .common import InfoExtractor
 from ..utils import (
     parse_duration,
     int_or_none,
+    ExtractorError,
 )
 
 
@@ -29,6 +30,10 @@ class Porn91IE(InfoExtractor):
         url = 'http://91porn.com/view_video.php?viewkey=%s' % video_id
         self._set_cookie('91porn.com', 'language', 'cn_CN')
         webpage = self._download_webpage(url, video_id, "get HTML content")
+
+        if '作为游客,你每天只可观看10个视频' in webpage:
+            raise ExtractorError('91 Porn says: Daily limit 10 videos exceeded', expected=True)
+
         title = self._search_regex(
             r'<div id="viewvideo-title">([^<]+)</div>', webpage, 'title')
         title = title.replace('\n', '')