aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/senateisvp.py
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2015-04-21 03:18:38 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2015-04-21 03:18:38 +0800
commit2fe1b5bd2add12d70717878704cd3f811af5d22c (patch)
tree63d25a5c6a9670eb5d07f536a9a8708b20464635 /youtube_dl/extractor/senateisvp.py
parentf91e1a8739a59bca1ced0bbc70f8cf9c3a33f778 (diff)
[CSpan] Add detection for Senate ISVP. Closes #5302
Diffstat (limited to 'youtube_dl/extractor/senateisvp.py')
-rw-r--r--youtube_dl/extractor/senateisvp.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/youtube_dl/extractor/senateisvp.py b/youtube_dl/extractor/senateisvp.py
index a93874cad..23e1cd944 100644
--- a/youtube_dl/extractor/senateisvp.py
+++ b/youtube_dl/extractor/senateisvp.py
@@ -3,7 +3,10 @@ from __future__ import unicode_literals
import re
from .common import InfoExtractor
-from ..utils import ExtractorError
+from ..utils import (
+ ExtractorError,
+ unsmuggle_url,
+)
from ..compat import (
compat_parse_qs,
compat_urlparse,
@@ -73,12 +76,22 @@ class SenateISVPIE(InfoExtractor):
}
}]
+ @staticmethod
+ def _search_iframe_url(webpage):
+ mobj = re.search(
+ r"<iframe[^>]+src=['\"](?P<url>http://www\.senate\.gov/isvp/\?[^'\"]+)['\"]",
+ webpage)
+ if mobj:
+ return mobj.group('url')
+
def _get_info_for_comm(self, committee):
for entry in self._COMM_MAP:
if entry[0] == committee:
return entry[1:]
def _real_extract(self, url):
+ url, smuggled_data = unsmuggle_url(url, {})
+
qs = compat_parse_qs(re.match(self._VALID_URL, url).group('qs'))
if not qs.get('filename') or not qs.get('type') or not qs.get('comm'):
raise ExtractorError('Invalid URL', expected=True)
@@ -87,7 +100,10 @@ class SenateISVPIE(InfoExtractor):
webpage = self._download_webpage(url, video_id)
- title = self._html_search_regex(r'<title>([^<]+)</title>', webpage, video_id)
+ if smuggled_data.get('force_title'):
+ title = smuggled_data['force_title']
+ else:
+ title = self._html_search_regex(r'<title>([^<]+)</title>', webpage, video_id)
poster = qs.get('poster')
if poster:
thumbnail = poster[0]