++ fix available resolution
This commit is contained in:
@@ -42,6 +42,7 @@ def _filter_video_formats(formats: List[Dict]) -> List[Dict]:
|
||||
for f in formats:
|
||||
if f.get("vcodec") == "none":
|
||||
continue
|
||||
height = f.get("height") or 0
|
||||
resolution = None
|
||||
if f.get("height") and f.get("width"):
|
||||
resolution = f"{f['height']}p"
|
||||
@@ -53,8 +54,11 @@ def _filter_video_formats(formats: List[Dict]) -> List[Dict]:
|
||||
"resolution": resolution,
|
||||
"fps": f.get("fps"),
|
||||
"size": _format_size(f.get("filesize")),
|
||||
"height": height,
|
||||
}
|
||||
)
|
||||
# Sort by height descending, put formats without height at the end
|
||||
videos.sort(key=lambda x: (x["height"] if x["height"] > 0 else -1), reverse=True)
|
||||
return videos
|
||||
|
||||
|
||||
|
||||
@@ -68,6 +68,11 @@ async function fetchInfo() {
|
||||
return `${f.ext} ${abr}${size}`;
|
||||
});
|
||||
|
||||
// Auto-select highest resolution (first video format)
|
||||
if (lastFormats.video.length > 0) {
|
||||
videoSelect.value = lastFormats.video[0].id;
|
||||
}
|
||||
|
||||
audioExt.disabled = false;
|
||||
|
||||
const minutes = data.duration ? Math.round(data.duration / 60) : '?';
|
||||
|
||||
Reference in New Issue
Block a user