mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[infoq] Fix extraction for HTTP URLs (closes #7739)
This commit is contained in:
parent
f6abca506e
commit
22d07ba4e4
1 changed files with 11 additions and 8 deletions
|
@ -3,10 +3,7 @@
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import (
|
from ..compat import compat_urllib_parse_unquote
|
||||||
compat_urllib_parse_unquote,
|
|
||||||
compat_urlparse,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class InfoQIE(InfoExtractor):
|
class InfoQIE(InfoExtractor):
|
||||||
|
@ -45,9 +42,11 @@ def _real_extract(self, url):
|
||||||
video_filename = playpath.split('/')[-1]
|
video_filename = playpath.split('/')[-1]
|
||||||
video_id, extension = video_filename.split('.')
|
video_id, extension = video_filename.split('.')
|
||||||
|
|
||||||
http_base = self._search_regex(
|
http_video_url = self._search_regex(r'P\.s\s*=\s*\'([^\']+)\'', webpage, 'video URL')
|
||||||
r'EXPRESSINSTALL_SWF\s*=\s*[^"]*"((?:https?:)?//[^/"]+/)', webpage,
|
|
||||||
'HTTP base URL')
|
policy = self._search_regex(r'InfoQConstants.scp\s*=\s*\'([^\']+)\'', webpage, 'policy')
|
||||||
|
signature = self._search_regex(r'InfoQConstants.scs\s*=\s*\'([^\']+)\'', webpage, 'signature')
|
||||||
|
key_pair_id = self._search_regex(r'InfoQConstants.sck\s*=\s*\'([^\']+)\'', webpage, 'key-pair-id')
|
||||||
|
|
||||||
formats = [{
|
formats = [{
|
||||||
'format_id': 'rtmp',
|
'format_id': 'rtmp',
|
||||||
|
@ -56,7 +55,11 @@ def _real_extract(self, url):
|
||||||
'play_path': playpath,
|
'play_path': playpath,
|
||||||
}, {
|
}, {
|
||||||
'format_id': 'http',
|
'format_id': 'http',
|
||||||
'url': compat_urlparse.urljoin(url, http_base) + real_id,
|
'url': http_video_url,
|
||||||
|
'http_headers': {
|
||||||
|
'Cookie': 'CloudFront-Policy=%s; CloudFront-Signature=%s; CloudFront-Key-Pair-Id=%s' % (
|
||||||
|
policy, signature, key_pair_id),
|
||||||
|
},
|
||||||
}]
|
}]
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue