mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-06 08:50:07 +01:00
Strip hash info from URL when making requests (Fixes #1038)
This commit is contained in:
parent
aa6b734e02
commit
b9d3e1635f
@ -125,6 +125,11 @@ def _request_webpage(self, url_or_request, video_id, note=None, errnote=None):
|
|||||||
|
|
||||||
def _download_webpage_handle(self, url_or_request, video_id, note=None, errnote=None):
|
def _download_webpage_handle(self, url_or_request, video_id, note=None, errnote=None):
|
||||||
""" Returns a tuple (page content as string, URL handle) """
|
""" 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)
|
urlh = self._request_webpage(url_or_request, video_id, note, errnote)
|
||||||
content_type = urlh.headers.get('Content-Type', '')
|
content_type = urlh.headers.get('Content-Type', '')
|
||||||
m = re.match(r'[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+\s*;\s*charset=(.+)', content_type)
|
m = re.match(r'[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+\s*;\s*charset=(.+)', content_type)
|
||||||
|
Loading…
Reference in New Issue
Block a user