aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/common.py
diff options
context:
space:
mode:
authorMattias Wadman <mattias.wadman@gmail.com>2017-02-03 05:10:13 +0100
committerYen Chi Hsuan <yan12125@gmail.com>2017-02-03 12:10:13 +0800
commit45024183aea169dc898902388f782485de02cbac (patch)
tree2e3d98d1cbe64b09c7fbfbe9ad0596e25994d135 /youtube_dl/extractor/common.py
parent33da98f4933ddc54c944bae985cfcc7b53563208 (diff)
downloadyoutube-dl-45024183aea169dc898902388f782485de02cbac.tar.xz
[infoq] Add audio only format if available (#11565)
* [infoq] Add audio only format if available Refactor cookie code into a function. Renamed formats to http_video, http_audio, rtmp_video Renamed extract functions to video instead of videos as they return one or no video. * [infoq] Rename to _extract_cookies as it more than one * [infoq] Remove redundant determine_ext * [infoq] Add comment about hardcoded URL * [infoq] Use _hidden_inputs instead of messy regex * [infoq] Probe if audio URL is valid Make it possible to pass headers to _is_valid_url * [infoq] Add audio only test
Diffstat (limited to 'youtube_dl/extractor/common.py')
-rw-r--r--youtube_dl/extractor/common.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py
index 5a15a9536..2c8ec1417 100644
--- a/youtube_dl/extractor/common.py
+++ b/youtube_dl/extractor/common.py
@@ -1025,13 +1025,13 @@ class InfoExtractor(object):
unique_formats.append(f)
formats[:] = unique_formats
- def _is_valid_url(self, url, video_id, item='video'):
+ def _is_valid_url(self, url, video_id, item='video', headers={}):
url = self._proto_relative_url(url, scheme='http:')
# For now assume non HTTP(S) URLs always valid
if not (url.startswith('http://') or url.startswith('https://')):
return True
try:
- self._request_webpage(url, video_id, 'Checking %s URL' % item)
+ self._request_webpage(url, video_id, 'Checking %s URL' % item, headers=headers)
return True
except ExtractorError as e:
if isinstance(e.cause, compat_urllib_error.URLError):