Stream audio from youtubeIs there a way to stream audio/video to an Apple Airplay Device?How can I download Youtube videos?download from YouTube using youtube-dlYoutube doesn't stream videos when accessed from the Youtube portalHow to get the highest quality audio with the smallest download size using youtube-dl?How to play YouTube videos in VLC Player?Downloading and playing audio from cacheyoutube-dl unable to download audio how to resolve that issue?How to force command line VLC to stream youtube videos of specific quality?How to download newly uploaded videos from a youtube channel?

How should I solve this integral with changing parameters?

What is this tube in a jet engine's air intake?

Why is there an extra space when I type "ls" on the Desktop?

Can I take the the bonus-action attack from Two-Weapon Fighting without taking the Attack action?

How do spaceships determine each other's mass in space?

Professor forcing me to attend a conference, I can't afford even with 50% funding

PTIJ: Who was the sixth set of priestly clothes for?

Why restrict private health insurance?

Locked Away- What am I?

Smooth vector fields on a surface modulo diffeomorphisms

cannot log in to the server after changing SSH port

Is there stress on two letters on the word стоят

Do Cubics always have one real root?

Create chunks from an array

Use Mercury as quenching liquid for swords?

Was it really inappropriate to write a pull request for the company I interviewed with?

What should I do when a paper is published similar to my PhD thesis without citation?

Count each bit-position separately over many 64-bit bitmasks, with AVX but not AVX2

What would be the most expensive material to an intergalactic society?

Cycles on the torus

Leveling the sagging side of the home

Is it a Cyclops number? "Nobody" knows!

Traveling to heavily polluted city, what practical measures can I take to minimize impact?

When an outsider describes family relationships, which point of view are they using?



Stream audio from youtube


Is there a way to stream audio/video to an Apple Airplay Device?How can I download Youtube videos?download from YouTube using youtube-dlYoutube doesn't stream videos when accessed from the Youtube portalHow to get the highest quality audio with the smallest download size using youtube-dl?How to play YouTube videos in VLC Player?Downloading and playing audio from cacheyoutube-dl unable to download audio how to resolve that issue?How to force command line VLC to stream youtube videos of specific quality?How to download newly uploaded videos from a youtube channel?













2















I just want to stream (whitout downloading) a youtube video.
Is there an easy way to do this with python or exists a script to do that?
Or i must download in a temporany file the video, convert it and play?










share|improve this question






















  • I imagine it would be tricky because Youtube is flash... however, there are some online services that let you convert the video into audio... have you thought about that? My favorite is keepvid.com

    – ilarsona
    Sep 1 '14 at 22:33















2















I just want to stream (whitout downloading) a youtube video.
Is there an easy way to do this with python or exists a script to do that?
Or i must download in a temporany file the video, convert it and play?










share|improve this question






















  • I imagine it would be tricky because Youtube is flash... however, there are some online services that let you convert the video into audio... have you thought about that? My favorite is keepvid.com

    – ilarsona
    Sep 1 '14 at 22:33













2












2








2


1






I just want to stream (whitout downloading) a youtube video.
Is there an easy way to do this with python or exists a script to do that?
Or i must download in a temporany file the video, convert it and play?










share|improve this question














I just want to stream (whitout downloading) a youtube video.
Is there an easy way to do this with python or exists a script to do that?
Or i must download in a temporany file the video, convert it and play?







python youtube streaming






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 1 '14 at 22:32









Wet WaterWet Water

13115




13115












  • I imagine it would be tricky because Youtube is flash... however, there are some online services that let you convert the video into audio... have you thought about that? My favorite is keepvid.com

    – ilarsona
    Sep 1 '14 at 22:33

















  • I imagine it would be tricky because Youtube is flash... however, there are some online services that let you convert the video into audio... have you thought about that? My favorite is keepvid.com

    – ilarsona
    Sep 1 '14 at 22:33
















I imagine it would be tricky because Youtube is flash... however, there are some online services that let you convert the video into audio... have you thought about that? My favorite is keepvid.com

– ilarsona
Sep 1 '14 at 22:33





I imagine it would be tricky because Youtube is flash... however, there are some online services that let you convert the video into audio... have you thought about that? My favorite is keepvid.com

– ilarsona
Sep 1 '14 at 22:33










3 Answers
3






active

oldest

votes


















4














pafy is a Python library that can be used to retrieve URLs to pass to VLC or mplayer, etc. You can specify audio only. It's well documented here and can be installed with sudo apt-get install python-pafy.



Note it comes with a command line tool called ytdl which seems similar to youtube-dl and, as such, won't really do what you want. You'll have to write some python. I assume by the nature of your question this is no problem, but let me know if you need further help.






share|improve this answer


















  • 1





    This is so cool, just one file which do what i want. Thank you! :)

    – Wet Water
    Sep 2 '14 at 12:29


















2














If you have vlc and the text-based browser lynx (both available from Ubuntu's repositories), there is a neat trick you can use to stream video from a commandline. The command I use will do a search and create a playlist of the first page of results which will play in vlc.



I created a simple script to handle the tricky syntax. The script is:



#!/bin/bash
lynx -dump "https://www.youtube.com/results?search_query="$1"" | egrep -o "http.*watch.*" | vlc -


So, if you name the script, say stream_youtube, you can just enter "stream_youtube "search term"



I just tried it out after not using it in a while, and noticed a couple of errors popping up in a window that I never saw before, but in spite of that annoyance, it still worked. Someone might find it useful, or at least interesting. :-)






share|improve this answer






























    2














    This is not the perfect solution for your problem, but it will maybe help you.



    youtube-dl



    There is a command line tool called youtube-dl, which offers many options. I think it will first download the full video and then convert to audio. I'm not sure whether there is a possibility to only download an audio stream, but I guess not. Also, youtube-dl is written in python, but it's not only a simple script.



    If you take a look at the manpage, look for the post-processing options. --extract-audio for example will convert the video file to an audio file. You can also set the --audio-format and the --audio-quality. You can also run any custom command after downloading with --exec CMD.




    • Get it from the Ubuntu Software Center: sudo apt install youtube-dl


    • Get it from Github: Then update it with sudo youtube-dl -U

    VLC steaming



    Alternatively, you can use VLC to stream the video and just ignore or turn off the video function.



    It should work to copy the url, open vlc and press CTRL+V or open a network steam (CTRL+N) and paste the url. Then click on Video->Videotrack->deactivate.



    Note that this will still stream the whole video, but it will not display it.






    share|improve this answer

























    • A useful alias: alias youtube-dl-audio='youtube-dl --ignore-errors --output "%(title)s.%(ext)s" --extract-audio --audio-format mp3 --audio-quality 0'

      – Pablo Bianchi
      2 hours ago










    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f518932%2fstream-audio-from-youtube%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4














    pafy is a Python library that can be used to retrieve URLs to pass to VLC or mplayer, etc. You can specify audio only. It's well documented here and can be installed with sudo apt-get install python-pafy.



    Note it comes with a command line tool called ytdl which seems similar to youtube-dl and, as such, won't really do what you want. You'll have to write some python. I assume by the nature of your question this is no problem, but let me know if you need further help.






    share|improve this answer


















    • 1





      This is so cool, just one file which do what i want. Thank you! :)

      – Wet Water
      Sep 2 '14 at 12:29















    4














    pafy is a Python library that can be used to retrieve URLs to pass to VLC or mplayer, etc. You can specify audio only. It's well documented here and can be installed with sudo apt-get install python-pafy.



    Note it comes with a command line tool called ytdl which seems similar to youtube-dl and, as such, won't really do what you want. You'll have to write some python. I assume by the nature of your question this is no problem, but let me know if you need further help.






    share|improve this answer


















    • 1





      This is so cool, just one file which do what i want. Thank you! :)

      – Wet Water
      Sep 2 '14 at 12:29













    4












    4








    4







    pafy is a Python library that can be used to retrieve URLs to pass to VLC or mplayer, etc. You can specify audio only. It's well documented here and can be installed with sudo apt-get install python-pafy.



    Note it comes with a command line tool called ytdl which seems similar to youtube-dl and, as such, won't really do what you want. You'll have to write some python. I assume by the nature of your question this is no problem, but let me know if you need further help.






    share|improve this answer













    pafy is a Python library that can be used to retrieve URLs to pass to VLC or mplayer, etc. You can specify audio only. It's well documented here and can be installed with sudo apt-get install python-pafy.



    Note it comes with a command line tool called ytdl which seems similar to youtube-dl and, as such, won't really do what you want. You'll have to write some python. I assume by the nature of your question this is no problem, but let me know if you need further help.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Sep 1 '14 at 23:28









    wxlwxl

    438218




    438218







    • 1





      This is so cool, just one file which do what i want. Thank you! :)

      – Wet Water
      Sep 2 '14 at 12:29












    • 1





      This is so cool, just one file which do what i want. Thank you! :)

      – Wet Water
      Sep 2 '14 at 12:29







    1




    1





    This is so cool, just one file which do what i want. Thank you! :)

    – Wet Water
    Sep 2 '14 at 12:29





    This is so cool, just one file which do what i want. Thank you! :)

    – Wet Water
    Sep 2 '14 at 12:29













    2














    If you have vlc and the text-based browser lynx (both available from Ubuntu's repositories), there is a neat trick you can use to stream video from a commandline. The command I use will do a search and create a playlist of the first page of results which will play in vlc.



    I created a simple script to handle the tricky syntax. The script is:



    #!/bin/bash
    lynx -dump "https://www.youtube.com/results?search_query="$1"" | egrep -o "http.*watch.*" | vlc -


    So, if you name the script, say stream_youtube, you can just enter "stream_youtube "search term"



    I just tried it out after not using it in a while, and noticed a couple of errors popping up in a window that I never saw before, but in spite of that annoyance, it still worked. Someone might find it useful, or at least interesting. :-)






    share|improve this answer



























      2














      If you have vlc and the text-based browser lynx (both available from Ubuntu's repositories), there is a neat trick you can use to stream video from a commandline. The command I use will do a search and create a playlist of the first page of results which will play in vlc.



      I created a simple script to handle the tricky syntax. The script is:



      #!/bin/bash
      lynx -dump "https://www.youtube.com/results?search_query="$1"" | egrep -o "http.*watch.*" | vlc -


      So, if you name the script, say stream_youtube, you can just enter "stream_youtube "search term"



      I just tried it out after not using it in a while, and noticed a couple of errors popping up in a window that I never saw before, but in spite of that annoyance, it still worked. Someone might find it useful, or at least interesting. :-)






      share|improve this answer

























        2












        2








        2







        If you have vlc and the text-based browser lynx (both available from Ubuntu's repositories), there is a neat trick you can use to stream video from a commandline. The command I use will do a search and create a playlist of the first page of results which will play in vlc.



        I created a simple script to handle the tricky syntax. The script is:



        #!/bin/bash
        lynx -dump "https://www.youtube.com/results?search_query="$1"" | egrep -o "http.*watch.*" | vlc -


        So, if you name the script, say stream_youtube, you can just enter "stream_youtube "search term"



        I just tried it out after not using it in a while, and noticed a couple of errors popping up in a window that I never saw before, but in spite of that annoyance, it still worked. Someone might find it useful, or at least interesting. :-)






        share|improve this answer













        If you have vlc and the text-based browser lynx (both available from Ubuntu's repositories), there is a neat trick you can use to stream video from a commandline. The command I use will do a search and create a playlist of the first page of results which will play in vlc.



        I created a simple script to handle the tricky syntax. The script is:



        #!/bin/bash
        lynx -dump "https://www.youtube.com/results?search_query="$1"" | egrep -o "http.*watch.*" | vlc -


        So, if you name the script, say stream_youtube, you can just enter "stream_youtube "search term"



        I just tried it out after not using it in a while, and noticed a couple of errors popping up in a window that I never saw before, but in spite of that annoyance, it still worked. Someone might find it useful, or at least interesting. :-)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Sep 1 '14 at 23:35









        Marty FriedMarty Fried

        13.7k53947




        13.7k53947





















            2














            This is not the perfect solution for your problem, but it will maybe help you.



            youtube-dl



            There is a command line tool called youtube-dl, which offers many options. I think it will first download the full video and then convert to audio. I'm not sure whether there is a possibility to only download an audio stream, but I guess not. Also, youtube-dl is written in python, but it's not only a simple script.



            If you take a look at the manpage, look for the post-processing options. --extract-audio for example will convert the video file to an audio file. You can also set the --audio-format and the --audio-quality. You can also run any custom command after downloading with --exec CMD.




            • Get it from the Ubuntu Software Center: sudo apt install youtube-dl


            • Get it from Github: Then update it with sudo youtube-dl -U

            VLC steaming



            Alternatively, you can use VLC to stream the video and just ignore or turn off the video function.



            It should work to copy the url, open vlc and press CTRL+V or open a network steam (CTRL+N) and paste the url. Then click on Video->Videotrack->deactivate.



            Note that this will still stream the whole video, but it will not display it.






            share|improve this answer

























            • A useful alias: alias youtube-dl-audio='youtube-dl --ignore-errors --output "%(title)s.%(ext)s" --extract-audio --audio-format mp3 --audio-quality 0'

              – Pablo Bianchi
              2 hours ago















            2














            This is not the perfect solution for your problem, but it will maybe help you.



            youtube-dl



            There is a command line tool called youtube-dl, which offers many options. I think it will first download the full video and then convert to audio. I'm not sure whether there is a possibility to only download an audio stream, but I guess not. Also, youtube-dl is written in python, but it's not only a simple script.



            If you take a look at the manpage, look for the post-processing options. --extract-audio for example will convert the video file to an audio file. You can also set the --audio-format and the --audio-quality. You can also run any custom command after downloading with --exec CMD.




            • Get it from the Ubuntu Software Center: sudo apt install youtube-dl


            • Get it from Github: Then update it with sudo youtube-dl -U

            VLC steaming



            Alternatively, you can use VLC to stream the video and just ignore or turn off the video function.



            It should work to copy the url, open vlc and press CTRL+V or open a network steam (CTRL+N) and paste the url. Then click on Video->Videotrack->deactivate.



            Note that this will still stream the whole video, but it will not display it.






            share|improve this answer

























            • A useful alias: alias youtube-dl-audio='youtube-dl --ignore-errors --output "%(title)s.%(ext)s" --extract-audio --audio-format mp3 --audio-quality 0'

              – Pablo Bianchi
              2 hours ago













            2












            2








            2







            This is not the perfect solution for your problem, but it will maybe help you.



            youtube-dl



            There is a command line tool called youtube-dl, which offers many options. I think it will first download the full video and then convert to audio. I'm not sure whether there is a possibility to only download an audio stream, but I guess not. Also, youtube-dl is written in python, but it's not only a simple script.



            If you take a look at the manpage, look for the post-processing options. --extract-audio for example will convert the video file to an audio file. You can also set the --audio-format and the --audio-quality. You can also run any custom command after downloading with --exec CMD.




            • Get it from the Ubuntu Software Center: sudo apt install youtube-dl


            • Get it from Github: Then update it with sudo youtube-dl -U

            VLC steaming



            Alternatively, you can use VLC to stream the video and just ignore or turn off the video function.



            It should work to copy the url, open vlc and press CTRL+V or open a network steam (CTRL+N) and paste the url. Then click on Video->Videotrack->deactivate.



            Note that this will still stream the whole video, but it will not display it.






            share|improve this answer















            This is not the perfect solution for your problem, but it will maybe help you.



            youtube-dl



            There is a command line tool called youtube-dl, which offers many options. I think it will first download the full video and then convert to audio. I'm not sure whether there is a possibility to only download an audio stream, but I guess not. Also, youtube-dl is written in python, but it's not only a simple script.



            If you take a look at the manpage, look for the post-processing options. --extract-audio for example will convert the video file to an audio file. You can also set the --audio-format and the --audio-quality. You can also run any custom command after downloading with --exec CMD.




            • Get it from the Ubuntu Software Center: sudo apt install youtube-dl


            • Get it from Github: Then update it with sudo youtube-dl -U

            VLC steaming



            Alternatively, you can use VLC to stream the video and just ignore or turn off the video function.



            It should work to copy the url, open vlc and press CTRL+V or open a network steam (CTRL+N) and paste the url. Then click on Video->Videotrack->deactivate.



            Note that this will still stream the whole video, but it will not display it.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 2 hours ago









            Pablo Bianchi

            2,89521535




            2,89521535










            answered Sep 1 '14 at 22:56









            verpfeiltverpfeilt

            1,38421841




            1,38421841












            • A useful alias: alias youtube-dl-audio='youtube-dl --ignore-errors --output "%(title)s.%(ext)s" --extract-audio --audio-format mp3 --audio-quality 0'

              – Pablo Bianchi
              2 hours ago

















            • A useful alias: alias youtube-dl-audio='youtube-dl --ignore-errors --output "%(title)s.%(ext)s" --extract-audio --audio-format mp3 --audio-quality 0'

              – Pablo Bianchi
              2 hours ago
















            A useful alias: alias youtube-dl-audio='youtube-dl --ignore-errors --output "%(title)s.%(ext)s" --extract-audio --audio-format mp3 --audio-quality 0'

            – Pablo Bianchi
            2 hours ago





            A useful alias: alias youtube-dl-audio='youtube-dl --ignore-errors --output "%(title)s.%(ext)s" --extract-audio --audio-format mp3 --audio-quality 0'

            – Pablo Bianchi
            2 hours ago

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f518932%2fstream-audio-from-youtube%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Möglingen Índice Localización Historia Demografía Referencias Enlaces externos Menú de navegación48°53′18″N 9°07′45″E / 48.888333333333, 9.129166666666748°53′18″N 9°07′45″E / 48.888333333333, 9.1291666666667Sitio web oficial Mapa de Möglingen«Gemeinden in Deutschland nach Fläche, Bevölkerung und Postleitzahl am 30.09.2016»Möglingen

            Virtualbox - Configuration error: Querying “UUID” failed (VERR_CFGM_VALUE_NOT_FOUND)“VERR_SUPLIB_WORLD_WRITABLE” error when trying to installing OS in virtualboxVirtual Box Kernel errorFailed to open a seesion for the virtual machineFailed to open a session for the virtual machineUbuntu 14.04 LTS Virtualbox errorcan't use VM VirtualBoxusing virtualboxI can't run Linux-64 Bit on VirtualBoxUnable to insert the virtual optical disk (VBoxguestaddition) in virtual machine for ubuntu server in win 10VirtuaBox in Ubuntu 18.04 Issues with Win10.ISO Installation

            Antonio De Lisio Carrera Referencias Menú de navegación«Caracas: evolución relacional multipleja»«Cuando los gobiernos subestiman a las localidades: L a Iniciativa para la Integración de la Infraestructura Regional Suramericana (IIRSA) en la frontera Colombo-Venezolana»«Maestría en Planificación Integral del Ambiente»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»«Conózcanos»«Caracas: evolución relacional multipleja»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»