Audio/video stream recording forums (http://stream-recorder.com/forum/index.php)
-   Video stream recording (http://stream-recorder.com/forum/forumdisplay.php?f=4)
-   -  

How to dump youtube live TV stream to file using commandline?

(http://stream-recorder.com/forum/showthread.php?t=15019)

MKANET 01-18-2013 12:09 PM

How to dump youtube live TV stream to file using commandline?


 
I only know of only two ways to download a live youtube video:

The first way is using the full youtube URL using packet sniffing. This provides me a ridiculously long URL; which only works one or two times before I get a ERROR 403: Forbidden response.

For example:
Code:

wget.exe -O "C:\liveTV-flv http://r7---sn-nx57yn7r.c.youtube.com/liveplay?algorithm=throttle-factor&burst=40&cp=U0hUTVVQVl9HTENONF9NSlpHOldPTUFUX2ZQdzNt&expire=1358558622&factor=1.25&fexp=909711%2C916613%2C920704%2C912806%2C922403%2C922405%2C929901%2C913605%2C925710%2C929104%2C929110%2C908493%2C920201%2C913302%2C919009%2C911116%2C926403%2C910221%2C901451&id=L7ird1HeEjw&ip=XXX.XXX.XXX.XXX&ipbits=8&itag=34&key=yt1&ms=nxu&mt=1358534109&mv=m&newshard=yes&ns=yt-live&signature=AF2D5423930D9DF2FD214BD5DFE8B2201049FBB6.376F4E9ED9D70050FA2E1447994FB7FF47CB1B44&source=youtube&sparams=algorithm%2Cburst%2Ccp%2Cfactor%2Cid%2Cip%2Cipbits%2Citag%2Cns%2Csource%2Cupn%2Cexpire&sver=3&upn=PWDvz8C-i_w&cpn=9xjxhbO0_V_Q4bat&begin=Infinity&ptk=youtube_none"

The next way is using youtube-dl (python script). This way is very reliable and easy:

For example:
Code:

youtube-dl.exe --no-part --max-quality 22 -o C:\liveTV.flv http://www.youtube.com/watch?feature=player_embedded&v=L7ird1HeEjw
This allows me to use the share URL youtube provides. Unfortunately, this method starts to download the video starting from when the live TV event first began, instead of the current time of the live event. I dont know how to specify to download starting from current live broadcast time.

I was hoping someone could help me figure out the a consistent way to download this live TV stream starting from current time.

chap 01-18-2013 02:55 PM

Re: How to dump youtube live TV stream to file using commandline?


 
try use
Code:

ffmpeg -i "http://www.youtube.com/api/manifest/hls/ns/yt-live/id/L7ird1HeEjw?ipbits=0&fexp=912806,922403,922405,929901,913605,925710,929104,929110,908493,920201,913302,919009,911116,910221,901451&ip=0.0.0.0&upn=9YCCj1LKFtA&sver=3&expire=1358569422&key=yt1&signature=5D978FEC838B33DC408C808994FD9BF942093ACF.508D9B2317448210736636866F47802ABAD13B27&sparams=id,ip,ipbits,ns,expire&file=index.m3u8" -c copy t.ts

MKANET 01-18-2013 03:42 PM

Re: How to dump youtube live TV stream to file using commandline?


 
Hi Chap, thank you so much for your help. I am able to use that URL. I have a question:

1. Is there a tutorial (or commandline app) which explains how to convert URLs like my original URL to a dependable URL? I prefer to learn to do this myself so I dont bother you for each URL :)

Sincerely,
MKANET

chap 01-18-2013 05:21 PM

Re: How to dump youtube live TV stream to file using commandline?


 
open(user agent=ipad)
Code:

http://m.youtube.com/watch?ajax=1&desktop_uri=/watch?feature=player_embedded&v=L7ird1HeEjw&feature=player_embedded&gl=RU&layout=mobile&tsp=1&utcoffset=120&v=L7ird1HeEjw&preq=
try use alternative
Code:

http://svnpenn.github.com/bm/

MKANET 01-18-2013 11:24 PM

Re: How to dump youtube live TV stream to file using commandline?


 
I think maybe I didn't explain correctly originally; or, there is a miscommunication. I have always been able to get a full URL to download a youtube video using packet sniffer apps. The problem is it doesnt work for more than a few times before I get a HTTP error 403 Forbidden error message. It seems like the URL you provided (below) has already stopped working.

I am actually looking for a reliable/consistent way to download the stream (starting at the current live TV position).

The closest I can get is when using the youtube-dl python script that I've already been using; except it seems like its meant for non-live TV videos (starts download from when the live TV stream first started to broadcast instead of "current" broadcast live TV position in the web browser.


Quote:

Originally Posted by chap (Post 58651)
try use
Code:

ffmpeg -i "http://www.youtube.com/api/manifest/hls/ns/yt-live/id/L7ird1HeEjw?ipbits=0&fexp=912806,922403,922405,929901,913605,925710,929104,929110,908493,920201,913302,919009,911116,910221,901451&ip=0.0.0.0&upn=9YCCj1LKFtA&sver=3&expire=1358569422&key=yt1&signature=5D978FEC838B33DC408C808994FD9BF942093ACF.508D9B2317448210736636866F47802ABAD13B27&sparams=id,ip,ipbits,ns,expire&file=index.m3u8" -c copy t.ts


chap 01-19-2013 12:04 AM

Re: How to dump youtube live TV stream to file using commandline?


 
simple use
Code:

http://svnpenn.github.com/bm/

MKANET 01-19-2013 11:24 AM

Re: How to dump youtube live TV stream to file using commandline?


 
Yes, I tried both suggestions the first time you mentioned it. Unfortunately, it produces a URL that can only be used a few times. If I try to use it again, for example, the next day. The stream is no longer accessible using the URL produced by the below bookmarklet ...getting a HTTP error 403 Forbidden error message. It doesnt seem to be any better than the URLS I get via a protocol analyzer. The only way I can consistently get the stream is via youtube-dl; its unfortunately not really meant for live TV streams. Maybe there's something I'm missing?

Quote:

Originally Posted by chap (Post 58662)
simple use
Code:

http://svnpenn.github.com/bm/


MKANET 01-19-2013 11:06 PM

Re: How to dump youtube live TV stream to file using commandline?


 
I wish there was a way to explain what I'm try to do more clearly.

It looks like Youtube.com is smart enough to not allow a static URL to access a video stream file more than a couple of times. Otherwise, it would be too easy. Im sure the URL would change pretty quicky. So, it doesnt even seem feasible to expect some kind of magic URL pointing to the every time. If there is, I haven't found a way to do that yet.

I am hoping someone was able to make a Windows command-line tool which can convert friendly short youtube URLs to a "direct" long URL to the file. Basically what the bookmarket above does, except in a self contained command-line app.

If there as a command-line converter that converted URLs like this:
http://www.youtube.com/watch?v=6QRKvM27Gxc

to

http://r16---sn-p5q7ynee.c.youtube.c...4DE5B4DF40314D

That would be great! Hopefully, Im not the only person who wants to do something like this.

evol 01-20-2013 06:22 AM

Re: How to dump youtube live TV stream to file using commandline?


 
Not a answer really but you could look into seeing if there is a Windows port of clive or cclive ?
clive
Code:

http://clive.sourceforge.net/
cclive
Code:

http://cclive.sourceforge.net/
That's if you are using Windows ?

hasomaso 01-20-2013 09:07 AM

Re: How to dump youtube live TV stream to file using commandline?


 
@evol

thanks for cclive
i downloaded cclive for windows but i could not download a youtube video?

that is the parameter

Code:

cclive "YoutubeURL" -f

you can help





thx
hasomaso


All times are GMT -6. The time now is 06:20 AM.