10.12 Sierra utilisation de youtube-dl sous terminal

devy

Membre actif
22 Septembre 2014
267
25
Bonjour,

suite à la lecture du livre de Nicolas concernant le Terminal, j'ai quelques questions concernant l'utilisation Youtube-dl sous celui ci.

Youtube-dl est recalcitrant chez moi : je suis obligé d'indiquer manuellement la resolution choisie via l'argument -f . Contrairement à ce qui est écrit dans le livre, chez moi en tout cas, la résolution max ne semble pas choisie par défaut, et au lieu d'un téléchargement j'ai une série de messages d'erreur.

exemple :
Bloc de code:
iMac-de-David:~ david$ youtube-dl https://www.youtube.com/watch?v=jjOwfFIgUhM
[youtube] jjOwfFIgUhM: Downloading webpage
[youtube] jjOwfFIgUhM: Downloading video info webpage
[youtube] jjOwfFIgUhM: Extracting video information
[youtube] jjOwfFIgUhM: Downloading MPD manifest
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/bin/youtube-dl/__main__.py", line 19, in <module>
  File "/usr/local/bin/youtube-dl/youtube_dl/__init__.py", line 459, in main
  File "/usr/local/bin/youtube-dl/youtube_dl/__init__.py", line 449, in _real_main
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1883, in download
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 772, in extract_info
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 826, in process_ie_result
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1483, in process_video_result
  File "/usr/local/bin/youtube-dl/youtube_dl/postprocessor/ffmpeg.py", line 48, in __init__
  File "/usr/local/bin/youtube-dl/youtube_dl/postprocessor/ffmpeg.py", line 105, in _determine_executables
  File "/usr/local/bin/youtube-dl/youtube_dl/postprocessor/ffmpeg.py", line 105, in <genexpr>
  File "/usr/local/bin/youtube-dl/youtube_dl/utils.py", line 1898, in get_exe_version
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1334, in _execute_child
    child_exception = pickle.loads(data)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1382, in loads
    return Unpickler(file).load()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 858, in load
    dispatch[key](self)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 966, in load_string
    raise ValueError, "insecure string pickle"
ValueError: insecure string pickle

Y à t'il une manipulation complémentaire à faire pour configurer youtube-dl ?

Merci.
 
Il y a peut-être un problème de version de Python. Tu utilises celle installée par défaut sur le système (2.7). Quelle est la version de Youtube-dl ?
 
Je dirais problème à l'installation. Quelle méthode as-tu suivie ?

Si ce n'est pas Homebrew, je te conseillerais de réinstaller en utilisant ce gestionnaire. Il devrait installer tout ce qui est nécessaire pour lui.
 
Youtube-dl était en version 2017-03-10 et je viens de le mettre à jour avec la version du jour à savoir : 2017-03-15 , sans effet sur mon problème.

Pour Python, n'ayant rien touché de ce côté j'ai tendance à dire que oui c'est la version par défaut.
Je vais essayé de faire marcher ma petite tête et trouver cette info.

Merci de ta réponse.
 
J'ai testé le téléchargement avec youtube-dl de cette même vidéo sur Yosemite et Sierra, avec le python de macOS (2.7.10) et une autre version qui traînait (2.7.12 livrée avec Anaconda) et je n'ai eu à chaque fois aucun message d'erreur.

C'est donc vraisemblablement un problème de version. J'ai la version 2017.01.05 de youtube-dl, une version "compilée" (en bytecode, comme on dit).
 
Nicolas, nos messages se sont croisés. Oui j'utilise Homebrew que j'ai mis à jour il me semble avant d'installer youtube-dl.
 
J'utilise la version de fournie directement par le créateur, ici.

C'est un fichier qui invoque python mais est précompilé en code intermédiaire (bytecode donc) et je pense qu'il comprend l'essentiel des modules nécessaires à son fonctionnement.
 
Passage sous la session admin , MAJ de brew, suppression de youtube-dl et réinstallation , pas d'amélioration :meh:

Python 2.7 selon les messages qui suivent, je n'ai pas approfondi la question pour le moment.



Bloc de code:
iMac-de-David:~ admin$ brew update
Updated 1 tap (homebrew/core).
==> New Formulae
biogeme                                               ctop                                                  tfenv
==> Updated Formulae
activemq        creduce         gtk+3           libwebsockets   mosquitto       nss             ponyc           swiftformat     todolist        youtube-dl ✔
azure-cli       crystal-lang    ldc             llvm            node            nvc             rtags           thefuck         ttyd
castxml         gegl            lftp            [email protected]    nomad           par2            sonarqube       tintin          vim
==> Renamed Formulae
recipes -> gnome-recipes
iMac-de-David:~ admin$ brew uninstall youtube-dl
Uninstalling /usr/local/Cellar/youtube-dl/2017.03.10... (11 files, 1.7MB)
iMac-de-David:~ admin$ brew install youtube-dl
==> Downloading https://homebrew.bintray.com/bottles/youtube-dl-2017.03.15.sierra.bottle.tar.gz
######################################################################## 100,0%
==> Pouring youtube-dl-2017.03.15.sierra.bottle.tar.gz
==> Caveats
To use post-processing options, `brew install ffmpeg` or `brew install libav`.

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completion has been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
  /usr/local/Cellar/youtube-dl/2017.03.15: 11 files, 1.7MB
iMac-de-David:~ admin$ youtube-dl https://www.youtube.com/watch?v=jjOwfFIgUhM
[youtube] jjOwfFIgUhM: Downloading webpage
[youtube] jjOwfFIgUhM: Downloading video info webpage
[youtube] jjOwfFIgUhM: Extracting video information
[youtube] jjOwfFIgUhM: Downloading MPD manifest
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/bin/youtube-dl/__main__.py", line 19, in <module>
  File "/usr/local/bin/youtube-dl/youtube_dl/__init__.py", line 464, in main
  File "/usr/local/bin/youtube-dl/youtube_dl/__init__.py", line 454, in _real_main
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1883, in download
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 772, in extract_info
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 826, in process_ie_result
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1483, in process_video_result
  File "/usr/local/bin/youtube-dl/youtube_dl/postprocessor/ffmpeg.py", line 48, in __init__
  File "/usr/local/bin/youtube-dl/youtube_dl/postprocessor/ffmpeg.py", line 105, in _determine_executables
  File "/usr/local/bin/youtube-dl/youtube_dl/postprocessor/ffmpeg.py", line 105, in <genexpr>
  File "/usr/local/bin/youtube-dl/youtube_dl/utils.py", line 1898, in get_exe_version
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1334, in _execute_child
    child_exception = pickle.loads(data)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1382, in loads
    return Unpickler(file).load()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 858, in load
    dispatch[key](self)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 966, in load_string
    raise ValueError, "insecure string pickle"
ValueError: insecure string pickle
iMac-de-David:~ admin$
 
J'utilise la version de fournie directement par le créateur, ici.

C'est un fichier qui invoque python mais est précompilé en code intermédiaire (bytecode donc) et je pense qu'il comprend l'essentiel des modules nécessaires à son fonctionnement.


Donc tu ne passes pas par BREW si j'ai bien compris ?

Il faudrait que je teste çà en supprimant youtube-dl via brew en préalable.
 
Pas mieux :D

Bloc de code:
iMac-de-David:~ admin$ sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
Password:
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     3    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     3    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   582    0   582    0     0    431      0 --:--:--  0:00:01 --:--:--  142k
100 1454k  100 1454k    0     0   246k      0  0:00:05  0:00:05 --:--:--  393k
iMac-de-David:~ admin$ sudo chmod a+rx /usr/local/bin/youtube-dl
iMac-de-David:~ admin$ youtube-dl https://www.youtube.com/watch?v=jjOwfFIgUhM
[youtube] jjOwfFIgUhM: Downloading webpage
[youtube] jjOwfFIgUhM: Downloading video info webpage
[youtube] jjOwfFIgUhM: Extracting video information
[youtube] jjOwfFIgUhM: Downloading MPD manifest
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/bin/youtube-dl/__main__.py", line 19, in <module>
  File "/usr/local/bin/youtube-dl/youtube_dl/__init__.py", line 464, in main
  File "/usr/local/bin/youtube-dl/youtube_dl/__init__.py", line 454, in _real_main
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1883, in download
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 772, in extract_info
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 826, in process_ie_result
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1483, in process_video_result
  File "/usr/local/bin/youtube-dl/youtube_dl/postprocessor/ffmpeg.py", line 48, in __init__
  File "/usr/local/bin/youtube-dl/youtube_dl/postprocessor/ffmpeg.py", line 105, in _determine_executables
  File "/usr/local/bin/youtube-dl/youtube_dl/postprocessor/ffmpeg.py", line 105, in <genexpr>
  File "/usr/local/bin/youtube-dl/youtube_dl/utils.py", line 1898, in get_exe_version
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1334, in _execute_child
    child_exception = pickle.loads(data)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1382, in loads
    return Unpickler(file).load()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 858, in load
    dispatch[key](self)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 966, in load_string
    raise ValueError, "insecure string pickle"
ValueError: insecure string pickle
iMac-de-David:~ admin$

Donc il me reste la piste d'un problème avec Python non ?
 
Bloc de code:
iMac-de-David:~ admin$ python
Python 2.7.10 (default, Jul 30 2016, 19:40:32)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 
Es-tu certain d'utiliser la version de youtube-dl que tu viens de télécharger ? Au cas où, précise bien le chemin complet jusqu'à la commande.
 
Je n'ai trouvé qu'une seule version d'installée.
J'ai testé tout de même sur tes conseils d'en préciser le chemin* mais çà ne change rien au problème.

*
Bloc de code:
/usr/local/bin/youtube-dl https://www.youtube.com/watch?v=jjOwfFIgUhM
 
Bizarre. Je viens de tester la version précompilée sur Windows/Cygwin avec python 2.7.12 et ça fonctionné tout aussi bien.

Il y a un fil sur le site de l'application qui parle de ce problème (ici) qui apparaît de temps en temps.
 
J'ai fais une lecture rapide cette aprem depuis l'Iphone du lien cité et j'en ai conclu qu'installer libav pourrait m'aider.

Ce qui est confirmé :

Bloc de code:
iMac-de-David:~ admin$ brew install libav
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
calcurse               git-subrepo            ibex                   [email protected]           [email protected]              [email protected]              sshguard

==> Installing dependencies for libav: faac
==> Installing libav dependency: faac
==> Downloading https://homebrew.bintray.com/bottles/faac-1.28.sierra.bottle.1.tar.gz
######################################################################## 100,0%
==> Pouring faac-1.28.sierra.bottle.1.tar.gz
  /usr/local/Cellar/faac/1.28: 15 files, 645.5KB
==> Installing libav
==> Downloading https://homebrew.bintray.com/bottles/libav-12.sierra.bottle.tar.gz
######################################################################## 100,0%
==> Pouring libav-12.sierra.bottle.tar.gz
  /usr/local/Cellar/libav/12: 9 files, 19.3MB
iMac-de-David:~ admin$ youtube-dl https://www.youtube.com/watch?v=jjOwfFIgUhM
[youtube] jjOwfFIgUhM: Downloading webpage
[youtube] jjOwfFIgUhM: Downloading video info webpage
[youtube] jjOwfFIgUhM: Extracting video information
[youtube] jjOwfFIgUhM: Downloading MPD manifest
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[download] Destination: Best sounding cam ever-jjOwfFIgUhM.f133.mp4
[download] 100% of 2.30MiB in 00:05
[download] Destination: Best sounding cam ever-jjOwfFIgUhM.f251.webm
[download] 100% of 1.17MiB in 00:03
[ffmpeg] Merging formats into "Best sounding cam ever-jjOwfFIgUhM.mkv"
Deleting original file Best sounding cam ever-jjOwfFIgUhM.f133.mp4 (pass -k to keep)
Deleting original file Best sounding cam ever-jjOwfFIgUhM.f251.webm (pass -k to keep)
iMac-de-David:~ admin$


Il me reste à relire au calme et à essayer de comprendre ! Ce qui s'annonce un peu plus complexe :D


En tout cas merci à bompi qui m'a aidé à résoudre ce problème, et à Nicolas grâce à qui j'ai trouvé une excuse pour mettre le nez dans le terminal.
 
Cool.

Il est possible que j'aie installé cette bibliothèque au cours de mes nombreuses installations/compilations : où l'on voit que c'est difficile de s'assurer du fonctionnement d'une commande et d'en décrire l'installation. :zen:
 
Si d'autres pouvaient faire le test, on pourrait alors confirmer la nécessité ou non d'installer LIBAV, et permettre à Nicolas de faire une mise à jour de son livre, si besoin.

a+