Skip to content

Commit

Permalink
m3u8 toggle (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bartixxx32 committed Sep 17, 2023
1 parent 32fe1a8 commit 1ea8390
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ You can configure all the following environment variables:
* ENABLE_FFMPEG = os.getenv("ENABLE_FFMPEG", False)
* PROVIDER_TOKEN: stripe token on Telegram payment
* PLAYLIST_SUPPORT: download playlist support
* M3U8_SUPPORT: download m3u8 files support
* ENABLE_ARIA2: enable aria2c download
* FREE_DOWNLOAD: free download count per day
* TOKEN_PRICE: token price per 1 USD
Expand Down
1 change: 1 addition & 0 deletions ytdlbot/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
PROVIDER_TOKEN = os.getenv("PROVIDER_TOKEN") or "1234"

PLAYLIST_SUPPORT = os.getenv("PLAYLIST_SUPPORT", False)
M3U8_SUPPORT = os.getenv("M3U8_SUPPORT", False)
ENABLE_ARIA2 = os.getenv("ENABLE_ARIA2", False)

FREE_DOWNLOAD = os.getenv("FREE_DOWNLOAD", 20)
Expand Down
5 changes: 4 additions & 1 deletion ytdlbot/ytdl_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
ENABLE_VIP,
OWNER,
PLAYLIST_SUPPORT,
M3U8_SUPPORT,
PROVIDER_TOKEN,
REQUIRED_MEMBERSHIP,
TOKEN_PRICE,
Expand Down Expand Up @@ -356,7 +357,9 @@ def link_checker(url: str) -> str:
):
return "Playlist or channel links are disabled."

if re.findall(r"m3u8|\.m3u8|\.m3u$", url.lower()):
if not M3U8_SUPPORT and (
re.findall(r"m3u8|\.m3u8|\.m3u$", url.lower())
):
return "m3u8 links are disabled."

with contextlib.suppress(yt_dlp.utils.DownloadError):
Expand Down

0 comments on commit 1ea8390

Please sign in to comment.