From 714e05314c78243bd7ec460d433a26dd33a647a8 Mon Sep 17 00:00:00 2001 From: STeven <127262689+steve3256@users.noreply.github.com> Date: Mon, 25 May 2026 10:40:46 +0330 Subject: [PATCH 1/2] Update Code [BETA 1.4.20 GUI].py Added Video codec Options Priority for YouTube ( VP9 and AVC Over AV01) --- Code [BETA 1.4.20 GUI].py | 51 +++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/Code [BETA 1.4.20 GUI].py b/Code [BETA 1.4.20 GUI].py index 9c56f78..6f5e0bd 100644 --- a/Code [BETA 1.4.20 GUI].py +++ b/Code [BETA 1.4.20 GUI].py @@ -2347,16 +2347,25 @@ def build_youtube_format(self, quality, audio_only): return "bestaudio/best" if quality == "best": - return "bv*[vcodec!=none]+ba/bestvideo+bestaudio/best" + return "bestvideo[vcodec*=?vp9]+bestaudio/bestvideo[vcodec*=?avc]+bestaudio/best" if quality in ["4320", "2160", "1440", "1080", "720", "480", "360", "240", "144"]: return ( + # 1. Exact height with VP9 + f"bestvideo[height={quality}][vcodec*=?vp9]+bestaudio/" + # 2. Exact height with AVC (H.264) + f"bestvideo[height={quality}][vcodec*=?avc]+bestaudio/" + # 3. Exact height with any codec (fallback if neither VP9/AVC exists at this specific res) f"bestvideo[height={quality}][vcodec!=none]+bestaudio/" - f"bestvideo[height<={quality}][vcodec!=none]+bestaudio/" + # 4. Nearest lower height with VP9 + f"bestvideo[height<={quality}][vcodec*=?vp9]+bestaudio/" + # 5. Nearest lower height with AVC + f"bestvideo[height<={quality}][vcodec*=?avc]+bestaudio/" + # 6. Absolute final fallback f"best[height<={quality}]/best" ) - return "bv*[vcodec!=none]+ba/bestvideo+bestaudio/best" + return "bestvideo[vcodec*=?vp9]+bestaudio/bestvideo[vcodec*=?avc]+bestaudio/best" def download_youtube(self, url, folder_name="", quality="best", audio_only=False, playlist=True, metadata=False): url = url.strip() @@ -3961,7 +3970,7 @@ def build(self): for index, title in enumerate(titles): tabs.set_title(index, title) - refresh_button = self.button("↻ Refresh storage", "info", "150px") + refresh_button = self.button("↻ Refresh storage", "info", "150px") refresh_button.on_click(lambda button: self.refresh_storage()) clear_button = self.button("Clear output", "neutral", "130px") clear_button.on_click(lambda button: self.output.clear_output()) @@ -4029,25 +4038,25 @@ def button(self, description, kind="primary", width="180px", start=False): label = str(description) icons = { - "Start": "▶", - "Download": "⬇", - "Save": "✓", - "Clear": "×", - "Remove": "×", - "Fetch": "↻", - "Repo": "⌁", - "Official": "★", - "Token": "◆", - "Storage": "◷", - "History": "≡", - "Files": "▣", - "Latest": "●", + "Start": "â–¶", + "Download": "⬇", + "Save": "✓", + "Clear": "×", + "Remove": "×", + "Fetch": "↻", + "Repo": "⌁", + "Official": "★", + "Token": "â—†", + "Storage": "â—·", + "History": "≡", + "Files": "â–£", + "Latest": "●", "Guide": "?", - "Project": "★", - "Create": "▦", - "ZIP": "▦", + "Project": "★", + "Create": "â–¦", + "ZIP": "â–¦", "SHA256": "#", - "aria2": "↯" + "aria2": "↯" } if not any(label.startswith(prefix + " ") for prefix in icons.values()): From 87fe53696a09c3c9f8e7cce904fac0691068a39d Mon Sep 17 00:00:00 2001 From: STeven <127262689+steve3256@users.noreply.github.com> Date: Fri, 29 May 2026 05:08:49 +0330 Subject: [PATCH 2/2] Created using Colab --- m3u8_downloader.ipynb | 158 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 m3u8_downloader.ipynb diff --git a/m3u8_downloader.ipynb b/m3u8_downloader.ipynb new file mode 100644 index 0000000..fe7a558 --- /dev/null +++ b/m3u8_downloader.ipynb @@ -0,0 +1,158 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "m3u8 downloader.ipynb", + "provenance": [], + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "MoLddhWRxwdv" + }, + "source": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "

M3u8 online Downloader

" + ] + }, + { + "cell_type": "code", + "metadata": { + "cellView": "form", + "id": "H0qP3yiDrMD8", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "def1941b-8b7e-4e75-aa34-b1265a0c00ce" + }, + "source": [ + "#@title ← Run
Mount Google Drive
\n", + "#@markdown
\"Icon\"\n", + "\n", + "from google.colab import drive\n", + "drive.mount('/content/drive')" + ], + "execution_count": 1, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Mounted at /content/drive\n" + ] + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "9t3VWUOoDZ1I", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "2a452204-b153-4883-b169-d518c28e06e9" + }, + "source": [ + "#@title ← Run
Paste m3u8 link
{ display-mode: \"form\" }\n", + "import os\n", + "M3u8_link = \"https://video.twimg.com/amplify_video/1848976816939102208/pl/avc1/1280x720/AYvzPRsEwjj0A0L1.m3u8\" #@param {type:\"string\"}\n", + "Download_location = \"/content/drive/MyDrive/myvideo.mp4\" #@param {type:\"string\"}\n", + "\n", + "\n", + "# Uninstall m3u8downloader as we will use yt-dlp\n", + "!pip uninstall -y m3u8downloader\n", + "\n", + "# Install yt-dlp\n", + "!pip install yt-dlp\n", + "\n", + "# Install ffmpeg if not already present (colab usually has it)\n", + "!sudo apt update && sudo apt install -y ffmpeg\n", + "\n", + "# Use yt-dlp to download the M3U8 stream\n", + "!yt-dlp -o \"$Download_location\" \"$M3u8_link\"" + ], + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Found existing installation: m3u8downloader 0.11.3\n", + "Uninstalling m3u8downloader-0.11.3:\n", + " Successfully uninstalled m3u8downloader-0.11.3\n", + "Collecting yt-dlp\n", + " Downloading yt_dlp-2026.3.17-py3-none-any.whl.metadata (182 kB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m182.3/182.3 kB\u001b[0m \u001b[31m4.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hDownloading yt_dlp-2026.3.17-py3-none-any.whl (3.3 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m3.3/3.3 MB\u001b[0m \u001b[31m45.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hInstalling collected packages: yt-dlp\n", + "Successfully installed yt-dlp-2026.3.17\n", + "Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [129 kB]\n", + "Get:2 https://cli.github.com/packages stable InRelease [3,917 B]\n", + "Hit:3 http://archive.ubuntu.com/ubuntu jammy InRelease\n", + "Get:4 https://r2u.stat.illinois.edu/ubuntu jammy InRelease [6,555 B]\n", + "Get:5 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]\n", + "Get:6 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [127 kB]\n", + "Get:7 https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/ InRelease [3,632 B]\n", + "Get:8 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [7,090 kB]\n", + "Get:9 https://cli.github.com/packages stable/main amd64 Packages [354 B]\n", + "Get:10 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [1,297 kB]\n", + "Get:11 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [3,959 kB]\n", + "Hit:12 https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu jammy InRelease\n", + "Hit:13 https://ppa.launchpadcontent.net/ubuntugis/ppa/ubuntu jammy InRelease\n", + "Get:14 https://r2u.stat.illinois.edu/ubuntu jammy/main amd64 Packages [3,029 kB]\n", + "Get:15 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [4,309 kB]\n", + "Get:16 https://r2u.stat.illinois.edu/ubuntu jammy/main all Packages [10.3 MB]\n", + "Get:17 http://archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [7,394 kB]\n", + "Get:18 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1,605 kB]\n", + "Fetched 39.3 MB in 3s (11.5 MB/s)\n", + "Reading package lists... Done\n", + "Building dependency tree... Done\n", + "Reading state information... Done\n", + "7 packages can be upgraded. Run 'apt list --upgradable' to see them.\n", + "\u001b[1;33mW: \u001b[0mSkipping acquire of configured file 'main/source/Sources' as repository 'https://r2u.stat.illinois.edu/ubuntu jammy InRelease' does not seem to provide it (sources.list entry misspelt?)\u001b[0m\n", + "Reading package lists... Done\n", + "Building dependency tree... Done\n", + "Reading state information... Done\n", + "ffmpeg is already the newest version (7:4.4.2-0ubuntu0.22.04.1).\n", + "0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.\n", + "[generic] Extracting URL: https://video.twimg.com/amplify_video/1848976816939102208/pl/avc1/1280x720/AYvzPRsEwjj0A0L1.m3u8\n", + "[generic] AYvzPRsEwjj0A0L1: Downloading webpage\n", + "[generic] AYvzPRsEwjj0A0L1: Downloading m3u8 information\n", + "[generic] AYvzPRsEwjj0A0L1: Checking m3u8 live status\n", + "[info] AYvzPRsEwjj0A0L1: Downloading 1 format(s): 0\n", + "[hlsnative] Downloading m3u8 manifest\n", + "[hlsnative] Total fragments: 874\n", + "[download] Destination: /content/drive/MyDrive/myvideo.mp4\n", + "\u001b[K[download] \u001b[0;94m 33.6%\u001b[0m of ~ 267.85MiB at \u001b[0;32m 563.51KiB/s\u001b[0m ETA \u001b[0;33m04:20\u001b[0m (frag 295/874)" + ] + } + ] + } + ] +} \ No newline at end of file