From 7227c101b31a3f976e335c3ba85012773ee079e4 Mon Sep 17 00:00:00 2001 From: Nicolas Graves Date: Tue, 12 Aug 2025 23:04:40 +0200 Subject: [PATCH] gnu: Add python-yewtube. * gnu/packages/video.scm (python-yewtube): New variable. Change-Id: I4c3d7a40ae09db8649cfc009413731c039435c00 Signed-off-by: Sharlatan Hellseher --- gnu/packages/video.scm | 63 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm index 22701aaa88915a05fdab0ea5b0d9dd9857b6a4d1..a16a1d193f0d5aa3a5a3672a4d03ca7e2b44055e 100644 --- a/gnu/packages/video.scm +++ b/gnu/packages/video.scm @@ -6685,6 +6685,69 @@ and press \"Record\". Peek is optimized for generating animated GIFs, but you can also directly record to WebM or MP4 if you prefer.") (license license:gpl3+))) +(define-public python-yewtube + (package + (name "python-yewtube") + (version "2.12.1") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/mps-youtube/yewtube") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1bvn1zcycsq2gnvs10hn82ic8zp9q4s9gmmi6flahg3wavpnspzr")))) + (build-system pyproject-build-system) + (arguments + (list + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'relax-requirements + (lambda _ + (substitute* "mps_youtube/__init__.py" + (("from pip\\._vendor import pkg_resources.*") + "") + (("__version__ =.*") + (format #f "__version__ = ~s~%" + #$(package-version this-package)))) + (substitute* "requirements.txt" + (("httpx.*") + "httpx\n")))) + (add-before 'check 'configure-tests + (lambda _ + (setenv "HOME" (getcwd)))) + ;; XXX: This can happen when some side-effects happens at + ;; initialization. See https://codeberg.org/guix/guix/issues/1089 + (add-before 'sanity-check 'patch-script + (lambda _ + (substitute* (string-append #$output "/bin/.yt-real") + (("import mps_youtube as mod") + "from mps_youtube.main import main") + (("sys\\.exit \\(mod\\.main\\.main \\(\\)\\)") + "sys.exit(main())")))) + (replace 'sanity-check + (lambda _ + (invoke (string-append #$output "/bin/yt") "-h")))))) + (native-inputs + (list python-dbus + python-pygobject + python-pytest + python-setuptools-next + python-wheel)) + (propagated-inputs + (list python-pylast + python-pyperclip + python-requests + python-youtube-search + yt-dlp)) + (home-page "https://github.com/mps-youtube/yewtube") + (synopsis "Terminal based YouTube player and downloader") + (description + "This package provides a terminal based @code{YouTube} player and +downloader. It does not require a Youtube API key.") + (license license:gpl3+))) + (define-public python-youtube-search (package (name "python-youtube-search")