« Youtube downloader : yt-dlp » : différence entre les versions

De www.yakakliker.org
Aucun résumé des modifications
Aucun résumé des modifications
 
(18 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
<syntaxhighlight lang="bash">
sudo apt update && sudo apt install quickjs nodejs aria2


python3 -m pip install yt-dlp -U
curl -fsSL https://deno.land/install.sh | sudo DENO_INSTALL=/usr/local sh
yt-dlp --js-runtime node --cookies-from-browser chrome -x --audio-format m4a --no-playlist "URL"
yt-dlp --remote-components ejs:github --cookies-from-browser chrome -x --audio-format m4a --no-playlist "URL"
</syntaxhighlight>
https://github.com/yt-dlp/yt-dlp/discussions/285
https://stackoverflow.com/questions/32104702/youtube-dl-library-and-error-403-forbidden-when-using-generated-direct-link-by
=== Petit script ===
<syntaxhighlight lang="bash">
#!/bin/bash
## Les variables
: ${VAR01=whiptail}
: ${url=}
############ Les variables
export selection="(◕_◕)"
export var25042301="(°_°)"
export var25070203="°(◕_◕)°"
export ver="PRY.260910"
export var24051101
var24051101=$(date +%y%m%d) # Variable date année-mois-jour
# Variables couleurs --- Pour faire sympa --- Oh la belle bleue !
export red="\033[31m" # Rouge
export turquoise="\033[36m" # Turquoise
export gras="\033[1m" # Gras
export rougegras="\033[1;31m" # Rouge Gras
export reset="\033[0m"
export alert="root=,red;window=,white;border=black,white;textbox=black,white;button=red,white"
export info="root=,blue;window=,white;border=black,white;textbox=black,white;button=red,white"
fct001(){
url=$(NEWT_COLORS="$info" whiptail --title "$ver" --inputbox "Entrez l'URL" 10 60 3>&1 1>&2 2>&3)
#yt-dlp -x --audio-format m4a $url
#yt-dlp --js-runtime node --remote-components ejs:github --cookies-from-browser chrome -x --audio-format m4a "$url"
yt-dlp -f "ba[ext=webm]/ba" -x --audio-format opus --downloader aria2c --js-runtime node --remote-components ejs:github --cookies-from-browser chrome "$url"
fct999
}
fct002(){
url=$(NEWT_COLORS="$info" whiptail --title "$ver" --inputbox "Entrez l'URL" 10 60 3>&1 1>&2 2>&3)
#yt-dlp --cookies-from-browser chrome -x --audio-format m4a $url --no-playlist
#yt-dlp --js-runtime node --remote-components ejs:github --cookies-from-browser chrome -x --audio-format m4a --no-playlist "$url"
yt-dlp -f "ba[ext=webm]/ba" -x --audio-format opus --downloader aria2c --js-runtime node --remote-components ejs:github --cookies-from-browser chrome --no-playlist "$url"
fct999
}
#####################################################
fct995() {
############# Sélection de l'action à exécuter ############################


sudo apt update && sudo apt install quickjs nodejs
var25062504=$(NEWT_COLORS="$info" whiptail --menu "$var25070203 : Que souhaitez vous faire ?" --title "$ver" 25 60 15 \
"fct001" "    Télécharger une playlist" \
"fct002" "    Télécharger une chanson" \
3>&1 1>&2 2>&3)


python3 -m pip install yt-dlp -U
exitstatus=$?
if [ $exitstatus = 0 ]; then
$var25062504 # Lancement de la fonction choisie
else
fct999
fi
}
#########################################################
 
 
############# Fin du script ############################
fct999() {
echo "(◕_◕) : That's all folks !" # Information de fin d'exécution du script
}
 
#### The Ultimate Software ! ####
 
fct995
 
## That's all
</syntaxhighlight>
 
=== Version Zenity ===
 
* Avec un certain nombre de fonctionnalités supplémentaires..
<syntaxhighlight lang="bash">
#!/bin/bash
 
## Les variables
: ${VAR01=zenity}
: ${url=}
 
############ Les variables
export selection="(◕_◕)"
export var25042301="(°_°)"
export var25070203="°(◕_◕)°"
export ver="PRY.260911"
 
export var24051101
var24051101=$(date +%y%m%d) # Variable date année-mois-jour
 
# Variables couleurs
export red="\033[31m"
export turquoise="\033[36m"
export gras="\033[1m"
export rougegras="\033[1;31m"
export reset="\033[0m"
 
fct000() {
# 1. Installation si absent
if ! command -v yt-dlp &> /dev/null; then
zenity --question \
--title="$ver" \
--text="<b>yt-dlp</b> n'est pas installé sur votre système.\n\nVoulez-vous l'installer via Snap maintenant ?" \
--width=400
 
if [ $? -eq 0 ]; then
(
echo "# Installation de yt-dlp via Snap..."
pkexec snap install yt-dlp
) | zenity --progress \
--title="$ver" \
--text="Installation en cours..." \
--pulsate \
--auto-close \
--width=400
 
if ! command -v yt-dlp &> /dev/null; then
zenity --error \
--title="$ver" \
--text="L'installation a échoué. Le script va s'arrêter." \
--width=400
exit 1
fi
else
exit 1
fi
fi
 
# 2. Vérification et recherche de mises à jour
(
echo "# Verification des mises a jour de yt-dlp..."
if snap list yt-dlp &> /dev/null; then
# Si installé via Snap
pkexec snap refresh yt-dlp
else
# Si installé en binaire manuel
pkexec yt-dlp -U
fi
) | zenity --progress \
--title="$ver" \
--text="Recherche de mises à jour..." \
--pulsate \
--auto-close \
--width=400
}
 
 
fct001(){
url=$(zenity --entry \
--title="$ver" \
--text="Entrez l'URL de la playlist :" \
--width=450)
 
if [ $? -eq 0 ] && [ -n "$url" ]; then
yt-dlp --newline \
--progress-template "download:[%(progress._percent_str)s] %(info.title)s (%(progress._speed_str)s)" \
-f "ba[ext=webm]/ba" -x --audio-format opus \
--js-runtime node --remote-components ejs:github --cookies-from-browser chrome \
"$url" | zenity --text-info \
--title="(◕_◕) - Suivi de la playlist" \
--width=650 \
--height=700 \
--auto-scroll
fi
 
fct999
}
 
fct002(){
url=$(zenity --entry \
--title="$ver" \
--text="Entrez l'URL de la chanson :" \
--width=450)
 
if [ $? -eq 0 ] && [ -n "$url" ]; then
yt-dlp --newline \
--progress-template "download:[%(progress._percent_str)s] %(info.title)s (%(progress._speed_str)s)" \
-f "ba[ext=webm]/ba" -x --audio-format opus \
--js-runtime node --remote-components ejs:github --cookies-from-browser chrome \
--no-playlist \
"$url" | zenity --text-info \
--title="(◕_◕) - Suivi du téléchargement" \
--width=650 \
--height=400 \
--auto-scroll
fi
 
fct999
}
 
#####################################################
 
fct995() {
############# Sélection de l'action à exécuter ############################
 
var25062504=$(zenity --list \
--radiolist \
--title="$ver" \
--text="$var25070203 : Que souhaitez-vous faire ?" \
--column="Choix" --column="Code" --column="Action" \
--hide-column=2 \
TRUE "fct001" "Télécharger une playlist" \
FALSE "fct002" "Télécharger une chanson" \
--width=450 \
--height=220)
 
if [ $? -eq 0 ] && [ -n "$var25062504" ]; then
$var25062504 # Lancement de la fonction choisie
else
fct999
fi
}
 
#########################################################
 
############# Fin du script ############################
fct999() {
echo -e "${turquoise}(◕_◕) : That's all folks !${reset}"
}
 
#### The Ultimate Software ! ####


curl -fsSL <nowiki>https://deno.land/install.sh</nowiki> | sudo DENO_INSTALL=/usr/local sh
fct000 # Vérification / Installation de yt-dlp
fct995 # Lancement du menu principal


yt-dlp --js-runtime node --cookies-from-browser chrome -x --audio-format m4a --no-playlist "<nowiki>https://www.youtube.com/watch?v=Pwv9_z6V7H8&list=RDPwv9_z6V7H8&start_radio=1</nowiki>"
## That's all
</syntaxhighlight>


yt-dlp --remote-components ejs:github --cookies-from-browser chrome -x --audio-format m4a --no-playlist "<nowiki>https://www.youtube.com/watch?v=Pwv9_z6V7H8&list=RDPwv9_z6V7H8&start_radio=1</nowiki>"
* On compile le script avec shc
** <code>shc -r -f Script.sh</code>
* On obtient alors un exécutable sous la forme "'''''Script.sh.x'''''".


=== Liens ===
[https://github.com/Yakakliker37/Base_info/blob/main/youtube-zenity.sh youtube-zenity.sh]


[https://github.com/Yakakliker37/Base_info/blob/main/youtube-zenity.sh.x youtube-zenity.sh.x]


https://github.com/yt-dlp/yt-dlp/discussions/285
[https://github.com/Yakakliker37/Base_info/blob/main/youtube.sh youtube.sh]


https://stackoverflow.com/questions/32104702/youtube-dl-library-and-error-403-forbidden-when-using-generated-direct-link-by




Ligne 34 : Ligne 293 :
</script>
</script>
‎</html>
‎</html>
[[Catégorie:Youtube]]
[[Catégorie:Download]]

Dernière version du 11 septembre 2026 à 11:46

sudo apt update && sudo apt install quickjs nodejs aria2

python3 -m pip install yt-dlp -U

curl -fsSL https://deno.land/install.sh | sudo DENO_INSTALL=/usr/local sh

yt-dlp --js-runtime node --cookies-from-browser chrome -x --audio-format m4a --no-playlist "URL"

yt-dlp --remote-components ejs:github --cookies-from-browser chrome -x --audio-format m4a --no-playlist "URL"


https://github.com/yt-dlp/yt-dlp/discussions/285

https://stackoverflow.com/questions/32104702/youtube-dl-library-and-error-403-forbidden-when-using-generated-direct-link-by

Petit script

#!/bin/bash

## Les variables
: ${VAR01=whiptail}
: ${url=}

############ Les variables
export selection="(◕_◕)"
export var25042301="(°_°)"
export var25070203="°(◕_◕)°"
export ver="PRY.260910"

export var24051101
var24051101=$(date +%y%m%d)																																			# Variable date année-mois-jour


# Variables couleurs --- Pour faire sympa --- Oh la belle bleue !
export red="\033[31m"																																				# Rouge
export turquoise="\033[36m"																																			# Turquoise
export gras="\033[1m"																																				# Gras
export rougegras="\033[1;31m"																																		# Rouge Gras
export reset="\033[0m"	

export alert="root=,red;window=,white;border=black,white;textbox=black,white;button=red,white"
export info="root=,blue;window=,white;border=black,white;textbox=black,white;button=red,white"

	



fct001(){

url=$(NEWT_COLORS="$info" whiptail --title "$ver" --inputbox "Entrez l'URL" 10 60 3>&1 1>&2 2>&3)

#yt-dlp -x --audio-format m4a $url
#yt-dlp --js-runtime node --remote-components ejs:github --cookies-from-browser chrome -x --audio-format m4a "$url"

yt-dlp -f "ba[ext=webm]/ba" -x --audio-format opus --downloader aria2c --js-runtime node --remote-components ejs:github --cookies-from-browser chrome "$url"

fct999

}

fct002(){

url=$(NEWT_COLORS="$info" whiptail --title "$ver" --inputbox "Entrez l'URL" 10 60 3>&1 1>&2 2>&3)

#yt-dlp --cookies-from-browser chrome -x --audio-format m4a $url --no-playlist
#yt-dlp --js-runtime node --remote-components ejs:github --cookies-from-browser chrome -x --audio-format m4a --no-playlist "$url"

yt-dlp -f "ba[ext=webm]/ba" -x --audio-format opus --downloader aria2c --js-runtime node --remote-components ejs:github --cookies-from-browser chrome --no-playlist "$url"

fct999

}

#####################################################


fct995() {
############# Sélection de l'action à exécuter ############################

		var25062504=$(NEWT_COLORS="$info" whiptail --menu "$var25070203 : Que souhaitez vous faire ?" --title "$ver" 25 60 15 \
			"fct001" "    Télécharger une playlist" \
			"fct002" "    Télécharger une chanson" \
			3>&1 1>&2 2>&3)

		exitstatus=$?
		if [ $exitstatus = 0 ]; then
			$var25062504																																			# Lancement de la fonction choisie
		else
			fct999
		fi
}
#########################################################


############# Fin du script ############################
fct999() {
	echo "(◕_◕) : That's all folks !"																																# Information de fin d'exécution du script
}

#### The Ultimate Software ! ####

fct995

## That's all

Version Zenity

  • Avec un certain nombre de fonctionnalités supplémentaires..
#!/bin/bash

## Les variables
: ${VAR01=zenity}
: ${url=}

############ Les variables
export selection="(◕_◕)"
export var25042301="(°_°)"
export var25070203="°(◕_◕)°"
export ver="PRY.260911"

export var24051101
var24051101=$(date +%y%m%d) # Variable date année-mois-jour

# Variables couleurs
export red="\033[31m"
export turquoise="\033[36m"
export gras="\033[1m"
export rougegras="\033[1;31m"
export reset="\033[0m"	

fct000() {
	# 1. Installation si absent
	if ! command -v yt-dlp &> /dev/null; then
		zenity --question \
			--title="$ver" \
			--text="<b>yt-dlp</b> n'est pas installé sur votre système.\n\nVoulez-vous l'installer via Snap maintenant ?" \
			--width=400

		if [ $? -eq 0 ]; then
			(
				echo "# Installation de yt-dlp via Snap..."
				pkexec snap install yt-dlp
			) | zenity --progress \
				--title="$ver" \
				--text="Installation en cours..." \
				--pulsate \
				--auto-close \
				--width=400

			if ! command -v yt-dlp &> /dev/null; then
				zenity --error \
					--title="$ver" \
					--text="L'installation a échoué. Le script va s'arrêter." \
					--width=400
				exit 1
			fi
		else
			exit 1
		fi
	fi

	# 2. Vérification et recherche de mises à jour
	(
		echo "# Verification des mises a jour de yt-dlp..."
		if snap list yt-dlp &> /dev/null; then
			# Si installé via Snap
			pkexec snap refresh yt-dlp
		else
			# Si installé en binaire manuel
			pkexec yt-dlp -U
		fi
	) | zenity --progress \
		--title="$ver" \
		--text="Recherche de mises à jour..." \
		--pulsate \
		--auto-close \
		--width=400
}


fct001(){
	url=$(zenity --entry \
		--title="$ver" \
		--text="Entrez l'URL de la playlist :" \
		--width=450)

	if [ $? -eq 0 ] && [ -n "$url" ]; then
		yt-dlp --newline \
			--progress-template "download:[%(progress._percent_str)s] %(info.title)s (%(progress._speed_str)s)" \
			-f "ba[ext=webm]/ba" -x --audio-format opus \
			--js-runtime node --remote-components ejs:github --cookies-from-browser chrome \
			"$url" | zenity --text-info \
			--title="(◕_◕) - Suivi de la playlist" \
			--width=650 \
			--height=700 \
			--auto-scroll
	fi

	fct999
}

fct002(){
	url=$(zenity --entry \
		--title="$ver" \
		--text="Entrez l'URL de la chanson :" \
		--width=450)

	if [ $? -eq 0 ] && [ -n "$url" ]; then
		yt-dlp --newline \
			--progress-template "download:[%(progress._percent_str)s] %(info.title)s (%(progress._speed_str)s)" \
			-f "ba[ext=webm]/ba" -x --audio-format opus \
			--js-runtime node --remote-components ejs:github --cookies-from-browser chrome \
			--no-playlist \
			"$url" | zenity --text-info \
			--title="(◕_◕) - Suivi du téléchargement" \
			--width=650 \
			--height=400 \
			--auto-scroll
	fi

	fct999
}

#####################################################

fct995() {
	############# Sélection de l'action à exécuter ############################

	var25062504=$(zenity --list \
		--radiolist \
		--title="$ver" \
		--text="$var25070203 : Que souhaitez-vous faire ?" \
		--column="Choix" --column="Code" --column="Action" \
		--hide-column=2 \
		TRUE "fct001" "Télécharger une playlist" \
		FALSE "fct002" "Télécharger une chanson" \
		--width=450 \
		--height=220)

	if [ $? -eq 0 ] && [ -n "$var25062504" ]; then
		$var25062504 # Lancement de la fonction choisie
	else
		fct999
	fi
}

#########################################################

############# Fin du script ############################
fct999() {
	echo -e "${turquoise}(◕_◕) : That's all folks !${reset}"
}

#### The Ultimate Software ! ####

fct000 # Vérification / Installation de yt-dlp
fct995 # Lancement du menu principal

## That's all
  • On compile le script avec shc
    • shc -r -f Script.sh
  • On obtient alors un exécutable sous la forme "Script.sh.x".

Liens

youtube-zenity.sh

youtube-zenity.sh.x

youtube.sh



‎ compteur web gratuit sans pub ‎

‎ ‎