diff --git a/net-misc/yt_dlp/yt_dlp-2025.10.22.recipe b/net-misc/yt_dlp/yt_dlp-2025.10.22.recipe deleted file mode 100644 index bb2b3ee44..000000000 --- a/net-misc/yt_dlp/yt_dlp-2025.10.22.recipe +++ /dev/null @@ -1,90 +0,0 @@ -SUMMARY="A command-line program to download videos from various sites" -DESCRIPTION="A fork of youtube-dl with additional features and fixes. \ -The program is usually invoked as youtube-dl followed by \ -options and the video URL. Run 'yt-dlp --help' and get a summary \ -of all options. -Some YouTube videos are served using Adobe's proprietary RTMP protocol, which \ -imposes DRM restrictions and encrypts the connection. yt-dlp is not able \ -to download these videos by itself." -HOMEPAGE="https://github.com/yt-dlp/yt-dlp" -COPYRIGHT="2006-2025 youtube-dl and yt-dlp contributors" -LICENSE="Unlicense" -REVISION="1" -SOURCE_URI="$HOMEPAGE/releases/download/$portVersion/yt-dlp.tar.gz" -SOURCE_FILENAME="yt-dlp-$portVersion.tar.gz" -CHECKSUM_SHA256="8ed2971172cbe1295258341e9f04527a7f27578538ce70ef4c9ebaba8966a969" -SOURCE_DIR="yt-dlp" - -ARCHITECTURES="any" - -pythonVersion=3.10 -pythonPackage=python${pythonVersion//.} - -PROVIDES=" - yt_dlp = $portVersion - cmd:yt_dlp = $portVersion - " -REQUIRES=" - haiku - ffmpeg6_tools - cmd:python$pythonVersion - # These are listed as optional dependencies in yt_dlp's pyproject.toml: - # brotli_$pythonPackage - # brotlicffi_$pythonPackage - # certifi_$pythonPackage - # mutagen_$pythonPackage - # pycryptodomex_$pythonPackage - requests_$pythonPackage # >=2.32.2,<3 - # urllib3_$pythonPackage # >=1.26.17,<3 - # websockets_$pythonPackage # >=13.0 - " - -# This recipe was previously built as if it was just a regular Python package recipe, -# and not as a CLI program that targets a particular Python version. -REPLACES=" - yt_dlp_python310 - " - -BUILD_REQUIRES=" - haiku_devel - build_$pythonPackage - hatchling_$pythonPackage - installer_$pythonPackage - " -BUILD_PREREQUIRES=" - cmd:find - cmd:make - cmd:python$pythonVersion - cmd:zip - " -TEST_REQUIRES=" - pytest_$pythonPackage - " - -BUILD() -{ - python$pythonVersion -m build --wheel --skip-dependency-check --no-isolation -} - -INSTALL() -{ - python$pythonVersion -m installer -p $prefix dist/*.whl - - # Install shell completions: - mv $prefix/share/bash-completion $dataDir - mv $prefix/share/fish $dataDir - mv $prefix/share/zsh $dataDir - - # Install man page and Readme: - mkdir -p $docDir $manDir - mv $prefix/share/man/man1 $manDir - mv $prefix/share/doc/yt_dlp/README.txt $docDir - - # Remove left over cruft: - rm -rf $prefix/share -} - -TEST() -{ - pytest-$pythonVersion -v -m "not download" -} diff --git a/net-misc/yt_dlp/yt_dlp-2025.11.12.recipe b/net-misc/yt_dlp/yt_dlp-2025.11.12.recipe new file mode 100644 index 000000000..86ce00af1 --- /dev/null +++ b/net-misc/yt_dlp/yt_dlp-2025.11.12.recipe @@ -0,0 +1,164 @@ +SUMMARY="A command-line program to download videos from various sites" +DESCRIPTION="A fork of youtube-dl with additional features and fixes. \ +The program is usually invoked as youtube-dl followed by \ +options and the video URL. Run 'yt-dlp --help' and get a summary \ +of all options. + +As of October/November of 2025, to be able to download from YouTube, yt-dlp \ +requires a Javascript engine. Of the ones it supports, only a couple are available \ +on Haiku at the moment (and only one on x86_32 bits: \"quickjs\"). + +So, for that use case, you'll need to: + +* Install either the \"quickjs\" or \"node\" packages: + \"> pkgman install cmd:qjs\" or \"> pkgman install cmd:node\" + +* Let yt-dlp know which one to use, for example: + \"> yt-dlp --js-runtime quickjs \" + +Note: you might also need to pass appropiate cookies (with \"--cookies-from-browser firefox\" \ +and/or, \"--cookies \". Consult the documentation for more details." +HOMEPAGE="https://github.com/yt-dlp/yt-dlp" +COPYRIGHT="2006-2025 youtube-dl and yt-dlp contributors" +LICENSE="Unlicense" +REVISION="1" +SOURCE_URI="https://github.com/yt-dlp/yt-dlp/releases/download/$portVersion/yt-dlp.tar.gz" +SOURCE_FILENAME="yt-dlp-$portVersion.tar.gz" +CHECKSUM_SHA256="561ead2e2991f11789d3cd9f9b5a2eee2641a587e2cfc1ee9631c7c1d851c0ec" +# This is needed if we need/want to avoid re-building the zimport/standalone yt-dlp: +# SOURCE_URI_2="https://github.com/yt-dlp/yt-dlp/releases/download/$portVersion/yt-dlp#noarchive" +# CHECKSUM_SHA256_2="89a0d9058ea9018e380b7771898ff46e393a1986dcd13fef331693c87ce1fca4" +SOURCE_DIR="yt-dlp" + +ARCHITECTURES="any" + +pythonVersion=3.10 +pythonPackage=python${pythonVersion//.} + +PROVIDES=" + yt_dlp = $portVersion + cmd:yt_dlp = $portVersion + " +# For cmd:yt_dlp, we require a bit more than the strict minimal dependencies, +# just to make the life of end users a bit simpler. +REQUIRES=" + haiku + ffmpeg6_tools # should be: cmd:ffmpeg/cmd:ffprobe instead (optional, but pretty much needed) + # cmd:qjs # (or cmd:node) needed to download from YT. + cmd:python$pythonVersion + # These are listed as optional dependencies in yt_dlp's pyproject.toml: + # brotli_$pythonPackage + # certifi_$pythonPackage + # mutagen_$pythonPackage + # pycryptodomex_$pythonPackage + requests_$pythonPackage # >=2.32.2,<3 (needed if using https proxies) + # urllib3_$pythonPackage # >=2.0.2,<3 + # websockets_$pythonPackage # >=13.0 + # yt_dlp_ejs_$pythonPackage # ==0.3.1. Already included on the "standalone" (zipimport) yt_dlp. + " + +# Allows using dot in sub-package names (eg: "_python3.10" vs "_python310"): +eval "PACKAGE_NAME_$pythonPackage=\"${portName}_python$pythonVersion\"" + +eval "SUMMARY_$pythonPackage=\"The yt-dlp Python module"\" + +eval "DESCRIPTION_$pythonPackage=\"This package contains yt-dlp, as a Python module, \ +for use by programmers or scripts that might require it. + +This package does not contains the yt-dlp command line utility, and only has a minimal \ +set of dependencies. + +For regular yt-dlp usage, see/install the 'yt_dlp' package instead. + \"" + +eval "PROVIDES_$pythonPackage=\" + ${portName}_python$pythonVersion = $portVersion + \"" +# Only require hard dependencies for the python module. +# People using this should be able to install optional deps as needed. +eval "REQUIRES_$pythonPackage=\" + haiku + cmd:python$pythonVersion + \"" + + +BUILD_REQUIRES=" + haiku_devel + build_$pythonPackage + hatchling_$pythonPackage + installer_$pythonPackage + " +BUILD_PREREQUIRES=" + cmd:find + cmd:make + cmd:python$pythonVersion + cmd:zip + " +TEST_REQUIRES=" + pytest_$pythonPackage + " + +PATCH() +{ + # not strictly required, but speeds up repeated builds a bit. + sed -i -e 's|-m pip |-m pip --disable-pip-version-check |' Makefile +} + +BUILD() +{ + # Build the .whl we'll use to install the Python module. + python$pythonVersion -m build --wheel --skip-dependency-check --no-isolation + + # We have two choices: either use the zimport/standalone yt-dlp from upstream release + # or re-build it ourselves (the one from the release tarball is not good, as it doesn't + # contains the "ejs" code). + + # Method 1: rebuild yt-dlp from release tarball code. + # (needs pip to download ejs code, but it *does* enforces known hashes). + python$pythonVersion -m ensurepip --default-pip + make yt-dlp-extra PREFIX="$prefix" MANDIR="$manDir" SHAREDIR="$dataDir" \ + PYTHON="python$pythonVersion" BINDIR="$binDir" + + # Method 2: use yt-dlp file from upstream releases. See INSTALL +} + +INSTALL() +{ + # First we install and package the Python module: + python$pythonVersion -m installer -p $prefix dist/*.whl + + packageEntries $pythonPackage \ + $prefix/lib/python* + + # And on the base package: + + # Note: we can't use "make install" here, because it overwrites yt-dlp with one without ejs. + # make install PREFIX="$prefix" MANDIR="$manDir" SHAREDIR="$dataDir" \ + # PYTHON="python$pythonVersion" BINDIR="$binDir" + + # "Method 2", replace yt-dlp from releast tarball with the "standalone" one: + # rm $binDir/yt-dlp + # cp $sourceDir2/yt-dlp $binDir/yt-dlp + # chmod +x $binDir/yt-dlp + + # Install the command: + install -t $binDir yt-dlp + + # Install shell completions: + mv $prefix/share/bash-completion $dataDir + mv $prefix/share/fish $dataDir + mv $prefix/share/zsh $dataDir + + # Install man page and Readme: + mkdir -p $docDir $manDir + mv $prefix/share/man/man1 $manDir + mv $prefix/share/doc/yt_dlp/README.txt $docDir + + # Remove left over cruft: + rm -rf $prefix/share +} + +TEST() +{ + pytest-$pythonVersion -v -m "not download" +}