yt-dpl: fix missing dependencies and patching cookies usage.

This commit is contained in:
Luis Guzmán 2026-02-07 18:48:44 -06:00
parent 36e3a9bcf8
commit 66c59ddc12
8 changed files with 190 additions and 10 deletions

View file

@ -86,12 +86,15 @@ index 5675445a..7afd324b 100644
if sys.platform in ('cygwin', 'win32'):
yield from map(os.path.expandvars, (
R'%APPDATA%\Mozilla\Firefox\Profiles',
@@ -205,7 +205,7 @@ def _firefox_browser_dirs():
else:
@@ -214,9 +214,9 @@ def _firefox_browser_dirs(browser_name='firefox'):
yield from map(os.path.expanduser, (
# New installations of FF147+ respect the XDG base directory specification
# Ref: https://bugzilla.mozilla.org/show_bug.cgi?id=259356
- os.path.join(_config_home(), 'mozilla/firefox'),
+ os.path.join(_config_home(), 'mozilla/{browser_name}'),
# Existing FF version<=146 installations
- '~/.mozilla/firefox',
+ f'~/.mozilla/{browser_name}',
'~/snap/firefox/common/.mozilla/firefox',
+ '~/.mozilla/{browser_name}',
# Flatpak XDG: https://docs.flatpak.org/en/latest/conventions.html#xdg-base-directories
'~/.var/app/org.mozilla.firefox/config/mozilla/firefox',
'~/.var/app/org.mozilla.firefox/.mozilla/firefox',
))

View file

@ -0,0 +1,35 @@
diff --git a/yt_dlp/cookies.py b/yt_dlp/cookies.py
index 8c05a09f..8b6f6613 100644
--- a/yt_dlp/cookies.py
+++ b/yt_dlp/cookies.py
@@ -1238,15 +1238,27 @@ def load(self, data):
else:
value, _ = self.value_decode(value)
- morsel[key] = value
+ try:
+ morsel[key] = value
+ except http.cookies.CookieError:
+ # Lenient mode: ignore invalid attributes
+ pass
elif is_attribute:
morsel = None
elif value is not None:
- morsel = self.get(key, http.cookies.Morsel())
+ morsel = self.get(key) or http.cookies.Morsel()
real_value, coded_value = self.value_decode(value)
- morsel.set(key, real_value, coded_value)
+ try:
+ morsel.set(key, real_value, coded_value)
+ except http.cookies.CookieError:
+ # Python 3.12+ rejects control characters in cookies.
+ # LenientSimpleCookie should accept them (yt-dlp tests expect this), so
+ # bypass Morsel.set() validation, assign underlying fields to read-only props.
+ morsel._key = key
+ morsel._value = real_value
+ morsel._coded_value = coded_value
self[key] = morsel
else:

29
helpers/make-flit-scm Normal file
View file

@ -0,0 +1,29 @@
#!/bin/sh
#
# Copyright (C) 2026 Luis Guzman <ark@switnet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
VERSION=1
EXTERNAL='deb-src http://archive.ubuntu.com/ubuntu noble universe'
BACKPORT=true
BUILD_UNTIL=11.0
. ./config
changelog "Backport dependency for newer yt-dlp"
package

29
helpers/make-hatchling Normal file
View file

@ -0,0 +1,29 @@
#!/bin/sh
#
# Copyright (C) 2026 Luis Guzman <ark@switnet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
VERSION=1
EXTERNAL='deb-src http://deb.debian.org/debian trixie main'
REPOKEY=6ED0E7B82643E131
BACKPORTS=true
BUILD_UNTIL=11.0
. ./config
changelog "Backport dependency for newer yt-dlp"
package

View file

@ -0,0 +1,29 @@
#!/bin/sh
#
# Copyright (C) 2026 Luis Guzman <ark@switnet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
VERSION=1
EXTERNAL='deb-src http://deb.debian.org/debian trixie main'
REPOKEY=6ED0E7B82643E131
BACKPORTS=true
BUILD_UNTIL=11.0
. ./config
changelog "Backport dependency for newer yt-dlp"
package

View file

@ -0,0 +1,29 @@
#!/bin/sh
#
# Copyright (C) 2026 Luis Guzman <ark@switnet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
VERSION=1
EXTERNAL='deb-src http://archive.ubuntu.com/ubuntu noble universe'
BACKPORT=true
BUILD_UNTIL=11.0
. ./config
changelog "Backport dependency for newer yt-dlp"
package

View file

@ -0,0 +1,29 @@
#!/bin/sh
#
# Copyright (C) 2026 Luis Guzman <ark@switnet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
VERSION=1
EXTERNAL='deb-src http://archive.ubuntu.com/ubuntu noble universe'
BACKPORT=true
BUILD_UNTIL=11.0
. ./config
changelog "Backport dependency for newer yt-dlp"
package

View file

@ -1,6 +1,6 @@
#!/bin/sh
#
# Copyright (C) 2025 Luis Guzman <ark@switnet.net>
# Copyright (C) 2026 Luis Guzman <ark@switnet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -34,9 +34,6 @@ sed -i "/Currently supported/s|are:|are at:|" debian/control
apply_patch_changes
echo "> Freeze build until there is new info for javascript dependency."
exit 1
changelog "Track latest release and remove explicit site listing, redirecting to website author."
package