|
24 | 24 | from shutil import copyfileobj
|
25 | 25 | import urllib.request
|
26 | 26 | from .utils import PersistentConnectionHandler, http_get
|
27 |
| -from .utils import urlencode_param |
28 | 27 | from sys import stderr
|
29 |
| -from urllib.parse import urljoin |
| 28 | +from urllib.parse import urljoin, urlencode, quote_plus |
30 | 29 | import io
|
31 | 30 | from .utils import xml_text_elements
|
32 | 31 | from . import flvlib
|
@@ -505,9 +504,10 @@ def progress_update(frontend, flv, time, duration):
|
505 | 504 | stderr.flush()
|
506 | 505 |
|
507 | 506 | def manifest_url(url, file, hdnea=None):
|
508 |
| - file += "/manifest.f4m?hdcore=" |
| 507 | + query = [("hdcore", "")] # Produces 403 Forbidden without this |
509 | 508 | if hdnea:
|
510 |
| - file += "&hdnea=" + urlencode_param(hdnea) |
| 509 | + query.append(("hdnea", hdnea)) |
| 510 | + file += "/manifest.f4m?" + urlencode(query) |
511 | 511 | return urljoin(url, file)
|
512 | 512 |
|
513 | 513 | def get_manifest(url, session):
|
@@ -640,9 +640,11 @@ def player_verification(manifest, player, key):
|
640 | 640 | sig = hmac.new(key, msg.encode("ascii"), sha256)
|
641 | 641 | pvtoken = "{}~hmac={}".format(msg, sig.hexdigest())
|
642 | 642 |
|
643 |
| - # The "hdntl" parameter must be passed either in the URL or as a cookie |
644 |
| - return "?pvtoken={}&{}".format( |
645 |
| - urlencode_param(pvtoken), urlencode_param(hdntl)) |
| 643 | + # The "hdntl" parameter must be passed either in the URL or as a cookie; |
| 644 | + # however the "pvtoken" parameter only seems to work in the URL |
| 645 | + pvtoken = urlencode((("pvtoken", pvtoken),)) |
| 646 | + hdntl = quote_plus(hdntl, safe="=") |
| 647 | + return "?{}&{}".format(pvtoken, hdntl) |
646 | 648 |
|
647 | 649 | def skip_box(stream):
|
648 | 650 | (_, size) = read_box_header(stream)
|
|
0 commit comments