Pushpa Raj
Pushpa Raj

Reputation: 89

how to Stream a youtube video in php?

There is site which gets direct link to youtube server as for example if we visit the link

http://vimow.com/watch?v=TLM6e_slo7Q-Play-Xbox-in-a-WEB-BROWSER?---Inside-Gaming-Daily

now if we view the page source will notice that there is the following link in video src

https://r5---sn-npo7enel.c.docs.google.com/videoplayback?mt=1410551258&expire=1410572981&ratebypass=yes&key=yt5&signature=C3FB417A7FB4C61600553152F9FFB57E473C762B.8F451B015AF741FFE45777DB5CEF424E452D433F&fexp=914095%2C927622%2C931983%2C932404%2C934030%2C946023%2C947209%2C948205%2C953600%2C953801%2C955400&upn=nnZKYWtq7gU&pfa=20s&initcwndbps=12869000&id=o-AMzBGT7otDdEr3LZCZRZA1hv1-ovI_PTghQHLJWtmAGq&ipbits=0&source=youtube&ms=au&pm_type=static&pbr=yes&mm=31&ip=128.199.133.159&sver=3&mv=m&sparams=id%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Cmm%2Cms%2Cmv%2Cpbr%2Cpfa%2Cpm_type%2Cratebypass%2Csource%2Cupn%2Cexpire&itag=18

my question is that how they are getting that link from youtube ?

i searched youtube api but did not find any solution.

Upvotes: 0

Views: 6378

Answers (5)

mehulmpt
mehulmpt

Reputation: 16597

I've messaged you about your query. Check once. Since its not allowed as in terms of YouTube ToS, I can't disclose the method publically.

Upvotes: 2

Wissam El-Kik
Wissam El-Kik

Reputation: 2525

The link you provided is a link in Google Drive. It has nothing to do with YouTube.

On another hand, if you're looking to embed YouTube videos in your website, then this will help you: https://developers.google.com/youtube/youtube_player_demo

If you want to stream a video while it occurs ("live streaming" or live coverage), then you need to use a special server which supports live streaming:

Keep in mind that you need a videocam which supports streaming services, or you should link the videocam to your computer. It depends on the streaming service you're using.

Upvotes: 1

KIKO Software
KIKO Software

Reputation: 16761

These movies are placed on Google Drive, and the link comes from there. See:

http://drive.google.com

For sharing details see:

https://support.google.com/drive/answer/2494822?hl=en&ref_topic=2525251

So, no, they're not from Youtube. There are API's for Google drive:

https://developers.google.com/drive/

For PHP see:

https://developers.google.com/drive/web/quickstart/quickstart-php

You'll have to familiarize yourself with this API before you can use it. The documentation by Google is far more than I could provide here.

Upvotes: 1

Pushpa Raj
Pushpa Raj

Reputation: 89

I have got the solution for this problem. Youtube videos are hosted in google's server. So we need to find the root link to the video and we can just stream the video using any HTML player. This is example of a link

https://r3---sn-npo7enee.c.docs.google.com/videoplayback?ms=au&source=youtube&mv=m&ip=128.199.175.59&initcwndbps=15683750&id=o-AOiPqW3plUekS9E0iFfUXJ6M6iuK8dAdvw0rtzBvFIMf&key=yt5&mm=31&ipbits=0&mt=1411445657&itag=18&sver=3&fexp=927622,930666,931983,932404,934030,936216,946023,947209,949408,952302,953801&upn=W8Os8snP-z8&sparams=id,initcwndbps,ip,ipbits,itag,mm,ms,mv,ratebypass,source,upn,expire&expire=1411467316&ratebypass=yes&signature=0F620B35EBCD3796509B9F72DC0EA15384721857.734B6A96DB834E600CEFBEF9305AA30E3F051A66

So i hope after getting this link you can easily stream a youtube video. You can use youtube downloader which fetches the link using CURL. A good script on github

https://github.com/jeckman/YouTube-Downloader

Using the script if you input the video id portion of any youtube video. Example: youtube(dot)com/watch?v=Fw-BM-Mqgeg

It uses curl to fetch the video link and u can use the link to stream video in your site.

Upvotes: 1

Youness
Youness

Reputation: 1495

got o youtube choose your video and click share after that click include (or something like that i can see it in french soo..) it will genereate a link like this one embed it in your page :

<iframe width="560" height="315" src="//www.youtube.com/embed/YoB8t0B4jx4" frameborder="0" allowfullscreen></iframe>

or you can just make it (the iframe adding the url of the video look at src of the iframe abouve

Upvotes: 1

Related Questions