Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 30 additions & 21 deletions Code [BETA 1.4.20 GUI].py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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()):
Expand Down
158 changes: 158 additions & 0 deletions m3u8_downloader.ipynb
Original file line number Diff line number Diff line change
@@ -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": [
"<a href=\"https://colab.research.google.com/github/steve3256/AzuDL-GC2GD/blob/main/m3u8_downloader.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "MoLddhWRxwdv"
},
"source": [
"<a href=\"https://github.com/jakiyaa/m3u8-downloader\">\n",
"<img src=\"https://github.com/fluidicon.png\" height=100px, align=\"left\"></a>\n",
"\n",
"\n",
"\n",
"<center><h1><b>M3u8 online Downloader </h1></b></center>"
]
},
{
"cell_type": "code",
"metadata": {
"cellView": "form",
"id": "H0qP3yiDrMD8",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "def1941b-8b7e-4e75-aa34-b1265a0c00ce"
},
"source": [
"#@title ← Run <Center>Mount Google Drive </Center>\n",
"#@markdown <Center> <img src=\"https://kstatic.googleusercontent.com/files/e20dbc1db7b6eab22fb2d07df8043f8a74b301dbb8c176e6a1992b2dc229c5ae94b5c260cf549c41712fa40b7e639166c6a8461303a27c2a3b9c55b8ca155ec3\" class=\"icon\" alt=\"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 <center> </font> <font color='red'> Paste m3u8 link <img src='https://play-lh.googleusercontent.com/vi_F_8raK3dL9D32R1VJRmWv18VKvc3niKDOE5z6yQsHOyzH0FQ1vq91eeakoEIFuxH9' height=\"40\" /> </center> { 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)"
]
}
]
}
]
}