aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/common.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-07-13 22:52:12 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2013-07-13 22:52:12 +0200
commitb9d3e1635fd2f5724452130bf2f05ea0112cd1ab (patch)
treecffc931df4f8cd713168ab9611fb51e5a403163e /youtube_dl/extractor/common.py
parentaa6b734e02b8c3dc8244a8cd8857e80c7c2953d6 (diff)
downloadyoutube-dl-b9d3e1635fd2f5724452130bf2f05ea0112cd1ab.tar.xz
Strip hash info from URL when making requests (Fixes #1038)
Diffstat (limited to 'youtube_dl/extractor/common.py')
-rw-r--r--youtube_dl/extractor/common.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py
index 52ae98be3..ec988fc90 100644
--- a/youtube_dl/extractor/common.py
+++ b/youtube_dl/extractor/common.py
@@ -125,6 +125,11 @@ class InfoExtractor(object):
def _download_webpage_handle(self, url_or_request, video_id, note=None, errnote=None):
""" Returns a tuple (page content as string, URL handle) """
+
+ # Strip hashes from the URL (#1038)
+ if isinstance(url_or_request, (compat_str, str)):
+ url_or_request = url_or_request.partition('#')[0]
+
urlh = self._request_webpage(url_or_request, video_id, note, errnote)
content_type = urlh.headers.get('Content-Type', '')
m = re.match(r'[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+\s*;\s*charset=(.+)', content_type)