Skip to content

Commit

Permalink
fix video quality sort
Browse files Browse the repository at this point in the history
  • Loading branch information
zhsj committed Sep 24, 2020
1 parent 58ad3dc commit 99ade46
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bplayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ def main(url):
duration_marquee=20,
is_reduce_comments=True,
)
src = sorted(
downloader.dash_streams.values(), key=lambda x: x["size"], reverse=True
)[0]["src"]
quality = {v["id"]: v["quality"] for v in downloader.stream_qualities.values()}
src = downloader.dash_streams[
sorted(
downloader.dash_streams.keys(),
key=lambda k: quality.get(k.replace("dash-", ""), 0),
)[-1]
]["src"]
headers = "Referer:{0},User-Agent:{1}".format(
downloader.referer, downloader.ua.replace(",", "\,")
)
Expand Down

0 comments on commit 99ade46

Please sign in to comment.