Skip to content

Commit 0473c86

Browse files
authored
Merge pull request #557 from arabcoders/dev
fix: use yt-dlp[default] for upgrading logic
2 parents d17aa6c + c67c991 commit 0473c86

File tree

32 files changed

+1701
-1585
lines changed

32 files changed

+1701
-1585
lines changed

.github/workflows/update-yt-dlp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
VER=$(uv pip list --outdated | awk '$1 == "yt-dlp" {print $3}')
4343
if [ -n "$VER" ]; then
4444
echo "YTLDLP_VER=${VER}" >> "$GITHUB_OUTPUT"
45-
uv pip install --upgrade yt-dlp
45+
uv pip install --upgrade yt-dlp[default]
4646
uv sync --upgrade
4747
UPDATED=true
4848
else

FAQ.md

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -317,22 +317,13 @@ Then simply create a new preset, and in the `Command options for yt-dlp` field s
317317

318318
```bash
319319
--extractor-args "youtubepot-bgutilhttp:base_url=http://bgutil_provider:4416"
320-
--extractor-args "youtube:player-client=default,tv,mweb;formats=incomplete"
321320
```
322321

323-
you and also enable the fallback by using the follow extractor args
324-
325-
```bash
326-
--extractor-args "youtubepot-bgutilhttp:base_url=http://bgutil_provider:4416;disable_innertube=1"
327-
--extractor-args "youtube:player-client=default,tv,mweb;formats=incomplete"
328-
```
329-
330-
Use this alternative extractor args in case the extractor fails to get the pot tokens from the bgutil provider server.
331322
For more information please visit [bgutil-ytdlp-pot-provider](https://github.com/Brainicism/bgutil-ytdlp-pot-provider) project.
332323

333324
# Troubleshooting and submitting issues
334325

335-
Before asking a question or submitting an issue for YTPTube, please remember that YTPTube is only a thin wrapper for
326+
Before asking a question or submitting an issue for YTPTube, please remember that YTPTube is only a wrapper for
336327
[yt-dlp](https://github.com/yt-dlp/yt-dlp). Any issues you might be experiencing with authentication to video websites,
337328
postprocessing, permissions, other `yt-dlp options` configurations which seem not to work, or anything else that
338329
concerns the workings of the underlying yt-dlp library, need not be opened on the YTPTube project.
@@ -343,7 +334,8 @@ and once that is working, importing the options that worked for you into a new `
343334
## Via HTTP
344335

345336
If you have enabled the web terminal via `YTP_CONSOLE_ENABLED` environment variable, simply go to `Other > Terminal` use
346-
the yt-dlp command, the interface is jailed to the `yt-dlp` binary you can't access anything else.
337+
the yt-dlp command, the interface is jailed to the `yt-dlp` binary you can't access anything else. Or from download form
338+
by clicking `advanced options` button than the yellow terminal icon `Run directly in console`.
347339

348340
## Via CLI
349341

@@ -503,7 +495,7 @@ as we only test for GPU encoding once on first video stream.
503495

504496
# Allowing internal URLs requests
505497

506-
By default, YTPTube prevents requests to internal resources, for security reasons. However, if you want to allow requests to internal URLs, you can set the `YTP_ALLOW_INTERNAL_URLS` environment variable to `true`. This will allow requests to internal URLs.
498+
By default, YTPTube prevents requests to internal resources. However, if you want to allow requests to internal URLs, you can set the `YTP_ALLOW_INTERNAL_URLS` environment variable to `true`. This will allow requests to internal URLs.
507499

508500
We do not recommend enabling this option unless you know what you are doing, as it can expose your internal network to
509501
potential security risks. This should only be used if it's truly needed.
@@ -557,7 +549,6 @@ services:
557549
After making the changes, restart your container. This should resolve the "No space left on device"
558550
error during download.
559551

560-
561552
# How to prevent loading screen during YouTube premieres?
562553

563554
Depending on how you look at it, YTPTube live download implementation is rather great and fast. However, during YouTube
@@ -566,7 +557,6 @@ playing. By default we wait for 5min + the duration of the video before starting
566557
the loading screen. However, you can override the behavior by setting the following environment variable:
567558

568559
```env
569-
YTP_PREVENT_LIVE_PREMIERE=true
570560
YTP_LIVE_PREMIERE_BUFFER=10
571561
```
572562

app/features/streaming/library/segments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ async def build_ffmpeg_args(self, file: Path, s_codec: str) -> list[str]:
9494
}
9595

9696
caps: dict[str, dict[str, bool]] = detect_qsv_capabilities()
97-
base_codec: str = s_codec.split("_")[0]
97+
base_codec: str = s_codec.split("_", maxsplit=1)[0]
9898
codec_caps: dict[str, bool] = caps.get(base_codec, {"full": False, "lp": False})
9999
ctx["qsv"] = codec_caps
100100

app/features/streaming/router.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ async def segments_stream(request: Request, config: Config, app: web.Application
213213
await Segments(
214214
download_path=config.download_path,
215215
index=int(segment),
216-
duration=float(f"{float(sd if sd else M3u8.duration):.6f}"),
216+
duration=float(f"{float(sd or M3u8.duration):.6f}"),
217217
vconvert=vc == 1,
218218
aconvert=ac == 1,
219219
).stream(realFile, resp)

app/features/tasks/definitions/service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ async def inspect(
397397

398398
return TaskFailure(
399399
message=extraction.message,
400-
error=extraction.error if extraction.error else extraction.message,
400+
error=extraction.error or extraction.message,
401401
metadata=combined_failure_metadata,
402402
)
403403

app/features/ytdlp/extractor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def extract_info_sync(
235235
archive_id: str | None = f".{id_dict['id']}" if id_dict.get("id") else None
236236

237237
log_wrapper.add_target(
238-
target=logging.getLogger(f"yt-dlp{archive_id if archive_id else '.extract_info'}"),
238+
target=logging.getLogger(f"yt-dlp{archive_id or '.extract_info'}"),
239239
level=logging.DEBUG if debug else logging.WARNING,
240240
)
241241

app/features/ytdlp/router.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ async def get_info(request: Request, cache: Cache, config: Config) -> Response:
394394
data["is_archived"] = False
395395

396396
archive_file: str | None = ytdlp_opts.get("download_archive")
397-
data["archive_file"] = archive_file if archive_file else None
397+
data["archive_file"] = archive_file or None
398398

399399
if archive_file and (archive_id := get_archive_id(url=url).get("archive_id")):
400400
data["archive_id"] = archive_id

app/features/ytdlp/ytdlp_opts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def __init__(self, item, config: Config | None = None):
130130
raise ValueError(msg)
131131

132132
self.item = item
133-
preset_name = item.preset if item.preset else self._config.default_preset
133+
preset_name = item.preset or self._config.default_preset
134134
self.preset: Preset | None = YTDLPCli._get_presets().get(preset_name)
135135
self._config: Config = config or Config.get_instance()
136136

app/library/ItemDTO.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def get_preset(self) -> "Preset | None":
227227
"""
228228
from app.features.presets.service import Presets
229229

230-
return Presets.get_instance().get(self.preset if self.preset else self._default_preset())
230+
return Presets.get_instance().get(self.preset or self._default_preset())
231231

232232
def get_archive_id(self) -> str | None:
233233
"""
@@ -553,7 +553,7 @@ def get_preset(self) -> "Preset | None":
553553
"""
554554
from app.features.presets.service import Presets
555555

556-
return Presets.get_instance().get(self.preset if self.preset else "default")
556+
return Presets.get_instance().get(self.preset or "default")
557557

558558
def archive_status(self, force: bool = False) -> None:
559559
"""

app/library/PackageInstaller.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,16 @@ def _install_pkg(self, pkg: str, version: str | None = None) -> bool:
113113
if "yt_dlp" == pkg:
114114
pkg = "yt-dlp"
115115

116+
pkg_name: str = "yt-dlp[default]" if pkg == "yt-dlp" else pkg
116117
if version:
117-
if "nightly" == version and pkg == "yt-dlp":
118-
cmd.extend(["--pre", "yt-dlp[default]"])
119-
elif "master" == version and pkg == "yt-dlp":
118+
if "nightly" == version and "yt-dlp" == pkg:
119+
cmd.extend(["--pre", pkg_name])
120+
elif "master" == version and "yt-dlp" == pkg:
120121
cmd.append("git+https://github.com/yt-dlp/yt-dlp.git@master")
121122
else:
122-
cmd.append(version if str(version).startswith("git+") else f"{pkg}=={version}")
123+
cmd.append(version if str(version).startswith("git+") else f"{pkg_name}=={version}")
123124
else:
124-
cmd.extend(["--disable-pip-version-check", pkg])
125+
cmd.extend(["--disable-pip-version-check", pkg_name])
125126

126127
try:
127128
proc: subprocess.CompletedProcess[bytes] = subprocess.run(

0 commit comments

Comments
 (0)