R
R
ruboss2015-10-18 20:21:39
Google
ruboss, 2015-10-18 20:21:39

How to make a request to YouTube for a video with a specific site?

Hello!
I get a link to a video from YouTube by its id and get a link to its stream:

http://r2---sn-8vap5-3c2l.googlevideo.com/videoplayback?fexp=9408494%2C9408710%2C9410705%2C9414764%2C9414806%2C9416126%2C9416729%2C9416985%2C9417707%2C9418201%2C9418440%2C9418494%2C9419039%2C9419444%2C9421764%2C9422401%2C9422556%2C9422947&mt=1445188318&mn=sn-8vap5-3c2l&mm=31&itag=18&ms=au&initcwndbps=2253750&mv=m&dur=140.109&source=youtube&ratebypass=yes&key=yt6&sparams=dur%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Csource%2Cupn%2Cexpire&upn=AsInLnfDdnI&signature=438607F8AA2A93754FCFFE257A13CD7CDE14C682.D5C6FA7B3CB4A0B348484AECEF048203279CFDD1&pl=21&mime=video%2Fmp4&ipbits=0&lmt=1416554308823000&sver=3&id=o-AIJ-al1B_AO8nUWfk_cn4en5MyX6Zg8i_itgCueskL8F&ip=77.120.172.184&expire=1445209991

YouTube itself sends similar requests to its servers when I switch the time in the player:
https://r2---sn-8vap5-3c2l.googlevideo.com/videoplayback?upn=Tdkdxxyupo8&clen=2250025&source=youtube&signature=1B93418CFB0D0DB9D3C2EE2EC8DF52F4B0F32029.5A49E646C5528C1D2FA6A8B5D9FB24B2A8A891F5&expire=1445209979&lmt=1416554251148566&requiressl=yes&gir=yes&mime=audio%2Fmp4&keepalive=yes&fexp=3300133%2C3300137%2C3300164%2C3310699%2C3311901%2C3312381%2C3312529%2C3312700%2C9407478%2C9408710%2C9414764%2C9416126%2C9417707&sparams=clen%2Cdur%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cupn%2Cexpire&id=o-AAcRbSjPkSlKPhRAQ4Kot5Dnlbipa-Kr1qaxQfzfmAt_&mt=1445188318&mv=m&dur=140.109&initcwndbps=2253750&itag=140&ms=au&ip=77.120.172.184&mm=31&mn=sn-8vap5-3c2l&pl=21&ipbits=0&key=yt6&sver=3&cpn=06S30YbtQxkGxrIy&alr=yes&ratebypass=yes&c=WEB&cver=html5&range=1927337-2248496&rn=51&rbuf=19878

The new parameters in the line are range=1927337-2248496&rn=51&rbuf=19878. As I understand it, these are commands to the server, which piece to return and how many bytes to skip in it
. The response from the youtube server to this request will appear in this form
xmoofmfhd`traftfhd tfdt^84trunÖÿÎ4mdat!]¢a£±Ql4ëï¦uÕܨ"ºÆ]-0¤wï> ü}]»áN0»Ös¤#ÛÄ5iÊG$ÇñÞFIª9È¡¬3N°§,F¢	=ÒrÎ0e9L|A©Eª¯u´¶ïédjyBæ1ÕKÂÍ-ƽÜÜí	Åu}.×å.,CÊfçÖÝAé>4îÈTòp¸<tÂìvâujîó4{ÚÛ_ÊH³!ºZHÐ.Ý*ÆÙYAzdbæñHÖ·H3¬³LT°#+ø[S;( Ò9ðΨÔû£|oý*ëzTg§û3Æ[PJ4Y

How can I modify the first link to get part of the video?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2015-10-18
@dimonchik2013

look at the parameters, maybe this is enough
shpargalkablog.ru/2013/10/start-youtube-video-minu...
in the link, most likely, a token, so you still have to calculate on the fly

F
frees2, 2015-10-18
@frees2

Good evening, this is a dangerous game because YouTube is constantly changing the link.
http://r2---sn-8vap5-3c2l.googlevideo.com........... in the header of this link via curl php there is also a link from the list you need to get it, but I already got tired and quit this one venture, they constantly change the request, so as not to download.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question