Simple YouTube download script

Forum Forums General Tips and Tricks Simple YouTube download script

  • This topic has 24 replies, 7 voices, and was last updated Mar 17-11:23 am by marcelocripe.
Viewing 15 posts - 1 through 15 (of 25 total)
  • Author
    Posts
  • #101378
    Member
    RJP

      At first install or update yt-dlp and optionallt you can make a config file for avaiding webm videos.

      The script:

      Edit: some reason platform shown script wrong, so I did not use codes.

      Edit 2: The script is in the zip-file

      • This topic was modified 2 months ago by RJP.
      • This topic was modified 2 months ago by RJP.
      • This topic was modified 2 months ago by RJP.
      #101383
      Member
      RJP
        Helpful
        Up
        1
        ::

        It works.

        Attachments:
        #101394
        Member
        Xunzi_23
          Helpful
          Up
          0
          ::

          Hi RJP
          Simpler, you can use ytfzf to search for yt content, and have it download with ytdlp
          or of course play. Big Advantage playlists and no need to know any content adress.

          fzf the fuzzy search tool does the finding.

          #101395
          Member
          RJP
            Helpful
            Up
            0
            ::

            To disable webm videos via config file.

            mkdir -p $HOME/.config/yt-dlp

            … and the config file

            nano $HOME/.config/yt-dlp/config

            … which contenst is

            --ignore-errors
            # --no-playlist
            
            # Save in ~/Videos
            -o ~/Videos/%(title)s.%(ext)s
            
            ### jos suomeksi niin laita Videot Videosin tilalle
            
            ####-o ~/Videot/%(title)s.%(ext)s
            
            # Prefer 1080p or lower resolutions
            -f bestvideo[ext=mp4][width<1280][height<=720]+bestaudio[ext=m4a]/bestvideo[width<1280][height<=720]+bestaudio/best[width<1280][height<=720]/best

            … save and quit

            Ctrl o
            Ctrl x

            #101399
            Member
            RJP
              Helpful
              Up
              0
              ::

              Hi RJP
              Simpler, you can use ytfzf to search for yt content, and have it download with ytdlp
              or of course play. Big Advantage playlists and no need to know any content adress.

              fzf the fuzzy search tool does the finding.

              ytfzf is not working.

              • This reply was modified 2 months ago by RJP.
              Attachments:
              #101402
              Member
              Xunzi_23
                Helpful
                Up
                1
                ::

                Sorry, Saw that problem on a friends computer yesterday, hope fix will be as easy for you
                as it was here.
                ta
                Please do sudo apt install --reinstall ytfzf and same for fzf

                find a video with ytfzf, have the mark next to the one wished for

                tap alt-d (download_shortcut) the selected video will be downloaded.

                Very powerful scripts as a quick glance in man ytfzf will show.

                • This reply was modified 2 months ago by Xunzi_23.
                • This reply was modified 2 months ago by Xunzi_23.
                • This reply was modified 2 months ago by Xunzi_23.
                #101408
                Member
                RJP
                  Helpful
                  Up
                  0
                  ::

                  ytfzf is working but fzf was not installed. Now ytfzf is working. 🙂

                  #101412
                  Member
                  PPC
                    Helpful
                    Up
                    0
                    ::

                    and for a nicer GUI, try:

                    ytfzf -t

                    Thank me later

                    P.

                    #101418
                    Member
                    Xunzi_23
                      Helpful
                      Up
                      0
                      ::

                      Hopefully useful to some

                      .bash_aliases in my setup
                      
                      alias yt='ytfzf --pages=3'
                      alias ytt='ytfzf -t --pages=2'
                      alias yto='ytfzf -cO pages=2'
                      #101426
                      Member
                      stevesr0
                        Helpful
                        Up
                        0
                        ::

                        Hi RJP,

                        I am making an Impress file and need to insert YouTube videos. They have been downloaded as .webm format and seem to work (although the CPU usage and frequency shoots up in Impress when running the embedded version; I think that is a problem with the Impress Media Player).

                        Question: What do you mean when you wrote

                        To disable webm videos via config file.

                        Are you transcoding them or filtering them out or…?

                        I am interested because I may want to try a different format that Impress might tolerate better.

                        Thanks in advance.

                        stevesr0

                        #101429
                        Member
                        Robin
                          Helpful
                          Up
                          1
                          ::

                          This is because of the high cpu load these webm files commonly produce. On weak machines they can cause desktop freeze due to the vp8/vp9/av1 video codec this container format only allowes. For these video formats mostly no hardware acceleration exists by now, so everything has to be processed and rendered by the cpu. Not the best idea… See https://en.wikipedia.org/wiki/VP9#Hardware_implementations for which CPUs and GPUs support it already. Single advantage of these video format is they are said to be free formats, but this doesn’t help people not being able to play them distortion free on their devices.

                          You can filter them using yt-dlp -F <‘url’> and then yt-dlp -f <‘format’> <‘url’> or yt-dlp -f <‘videoformat+audioformat’> <‘url’> while downloading, the latter is meant for video only and audio only formats from the ID column, the video format has to be the first one. You can transcode them also, but this means quality loss and bigger file size in most cases. You can also avoid these resource hungry formats automatically by using yt-dlp -f ‘[vcodec!=vp9][vcodec!=vp8][vcodec!=av1]’ <‘url’> for the download.

                          Windows is like a submarine. Open a window and serious problems will start.

                          #101468
                          Member
                          Xunzi_23
                            Helpful
                            Up
                            0
                            ::

                            RJP was second user in two days with ytfzf fail issue. Missing fzf but the error shown to users does not
                            help much.

                            @ anticapitalista I just checked a package list for antiX 22 ytfzf is included but the tool it depends on fzf
                            fuzzy search application is missing.

                            Could it please be included in an update to antiX versions which ship with ytfzf.

                            #101472
                            Member
                            RJP
                              Helpful
                              Up
                              0
                              ::

                              RJP was second user in two days with ytfzf fail issue. Missing fzf but the error shown to users does not
                              help much.

                              @ anticapitalista I just checked a package list for antiX 22 ytfzf is included but the tool it depends on fzf
                              fuzzy search application is missing.

                              Could it please be included in an update to antiX versions which ship with ytfzf.

                              Package ueberzug is also needed with ytfzf. 😉

                              sudo apt install ytfzf fzf ueberzug

                              #101483
                              Member
                              Robin
                                Helpful
                                Up
                                0
                                ::

                                just checked a package list … antiX 22

                                @anticapitalista : just checked on antiX 23: Here also fzf is missing (should be a dependency of ytfzf package probably)
                                Package ueberzug was installed, but it might have been drawn in by some other package I installed earlier, so I’m not sure about the latter.

                                Many thanks Xunzi23 and PPC, this ytfzf tool is a great recommendation. Didn’t know this tool before.

                                Windows is like a submarine. Open a window and serious problems will start.

                                #101501
                                Member
                                marcelocripe
                                  Helpful
                                  Up
                                  0
                                  ::

                                  Hello RJP.

                                  Thank you very much for your program to download videos from YouTube.

                                  I tried to apply the translation resources in your “YOUTUBE_DOWNLOADER”, but all the texts that are inside “TUBE=`yad” do not enter the “.pot” file that serves as a model for later generating the “.po” files and “.mo” containing the translations.

                                  In case, is there another way to write this part of the program?

                                  Apparently, everything inside the single quote “`” cannot be read by the command that generates the “.pot” file. Since I don’t understand the Bash programming language, I can’t make big changes.

                                  Would it be possible to put the texts that are displayed in the dialog boxes in variables?

                                  Normally, when the texts that are displayed in dialog boxes (window title and window body texts) are placed in variables, the translation procedure tends to be easier to implement.

                                  Thank you very much!

                                  Note: Following my original Brazilian Portuguese text is a proposed .desktop file. Please, if you are a native English speaker, review or correct the texts in English.

                                  – – – – –

                                  Olá RJP.

                                  Muito obrigado pelo seu programa para baixar vídeos do YouTube.

                                  Eu tentei aplicar os recursos de tradução no seu “YOUTUBE_DOWNLOADER”, mas todos os textos que estão dentro de “TUBE=`yad” não entram no arquivo “.pot” que serve de modelo para depois ser gerado os arquivos “.po” e “.mo” contendo as traduções.

                                  Por caso, existe um outro modo de escrever esta parte do programa?

                                  Ao que parece, tudo que está dentro da aspas simples “`” não consegue ser lido pelo comando que gera o arquivo “.pot”. Como eu não compreendo a linguagem de programação Bash, eu não consigo fazer grandes alterações.

                                  Seria possível colocar os textos que são exibidos nas caixas de diálogos em variáveis?

                                  Normalmente quando os textos que são exibidos nas caixas de diálogos (textos do título da janela e do corpo da janela) são colocadas em variáveis o procedimento de tradução costuma ficar mais fácil de ser implementando.

                                  Muito obrigado!

                                  Observação: Após o meu texto original em Português do Brasil está um proposta para o arquivo .desktop. Por favor, quem for nativo do Inglês, revise ou corrija os textos em Inglês.

                                  – – – – –

                                  
                                  [Desktop Entry]
                                  Categories=AudioVideo;Audio;Player;
                                  Encoding=UTF-8
                                  
                                  # If the script is stored in the /opt/youtube_downloader/ folder with the program file name in capital letters
                                  #Exec=/opt/youtube_downloader/YOUTUBE_DOWNLOADER
                                  
                                  #or
                                  
                                  # If the script is stored in the /opt/youtube_downloader/ folder with the program file name in lower case
                                  #Exec=/opt/youtube_downloader/youtube_downloader
                                  
                                  #or
                                  
                                  # If the script is stored in the /usr/local/bin folder with the program filename in lower case
                                  #Exec=youtube_downloader
                                  
                                  Icon=youtube
                                  Terminal=false
                                  Type=Application
                                  
                                  Name=Youtube Videos Downloader
                                  Name[pt]=Transferir Vídeos do YouTube
                                  Name[pt_BR]=Baixar Vídeos do YouTube
                                  
                                  Comment=Download youtube video via GUI 
                                  Comment[pt]=Transferir vídeos do YouTube em um interface gráfico, copiar o URL do YouTube, colar no programa e clique no botão Transferir
                                  Comment[pt_BR]=Baixar vídeos do YouTube em uma interface gráfica, copie o URL do YouTube, cole no programa e clique no botão Baixar
                                  
                                Viewing 15 posts - 1 through 15 (of 25 total)
                                • You must be logged in to reply to this topic.