Stream audio from youtubeIs there a way to stream audio/video to an Apple Airplay Device?How can I download...

Origin of the word “pushka”

How to install round brake pads

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

Short scifi story where reproductive organs are converted to produce "materials", pregnant protagonist is "found fit" to be a mother

Are all players supposed to be able to see each others' character sheets?

Can the Witch Sight warlock invocation see through the Mirror Image spell?

Trocar background-image com delay via jQuery

Can I negotiate a patent idea for a raise, under French law?

Sampling from Gaussian mixture models, when are the sampled data independent?

Why aren't there more Gauls like Obelix?

How do I increase the number of TTY consoles?

Writing text next to a table

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

What can I do if someone tampers with my SSH public key?

Movie: boy escapes the real world and goes to a fantasy world with big furry trolls

Finding the minimum value of a function without using Calculus

Will expression retain the same definition if particle is changed?

Is "cogitate" used appropriately in "I cogitate that success relies on hard work"?

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

What do you call someone who likes to pick fights?

Is it appropriate to ask a former professor to order a book for me through an inter-library loan?

Is divide-by-zero a security vulnerability?

Difference between `nmap local-IP-address` and `nmap localhost`

Translation of 答えを知っている人はいませんでした



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
      12 mins 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
              12 mins 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
              12 mins 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 11 mins 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
              12 mins 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
              12 mins 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
            12 mins 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
            12 mins 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

            Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

            Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

            Simple Scan not detecting my scanner (Brother DCP-7055W)Brother MFC-L2700DW printer can print, can't...