Play youtube video using youtube api v3 in php - php

I am using YouTube Data API(v3) for accessing data of youtube.
I search a lot how can I play a video in PHP using this API, but I couldn't find anything.
I know there is a way to play YouTube videos.
Embed a video
Using iFrame
However, YouTube is blocked in region I live, which means I can't use any method from them.
Are there any workarounds?
For instance, playit.pk can play videos even if region is blocked.
UPDATE
how can playit.pk access YouTube video URL like.
https://r2---sn-npo7en7d.c.doc-0-0-sj.sj.googleusercontent.com/videoplayback?upn=yS-T9e4J_3o&id=15589d4018f319ea&mime=video/mp4&mm=31&mn=sn-npo7en7d&ms=au&mt=1444897255&mv=m&ip=2400:6180:0:d0::27:f001&key=yt6&initcwndbps=13453750&ipbits=0&ratebypass=yes&sver=3&signature=A365AA3ADA506748AE53F0493B34E4B4AE807DCC.9F8EB21E86E4F5682BFFD44768102434DA58341B&fexp=9405958,9408710,9413271,9414764,9416126,9416359,9417707,9418204,9418400,9418809,9418997,9419837,9420351,9421923,9422553&nh=IgpwcjAxLnNpbjAzKgkxMjcuMC4wLjE&expire=1444918985&sparams=dur,id,initcwndbps,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,nh,pl,ratebypass,requiressl,source,upn,expire&source=youtube&dur=408.090&itag=18&pl=48&requiressl=yes&lmt=1434858572379608
If I found this kind of url I can play video very easily.
Can i access that kind of URL using api v3 if not then how can they do that.

Related

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.
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.
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
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.
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.
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:
You can use the YouTube Live API: https://developers.google.com/youtube/v3/live/
You can use LiveSteam: http://new.livestream.com/
and there's many other streaming services
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.

Vimeo video downloading through API

Is there a way to get the direct download link of a vimeo video using PHP vimeo API?
I tried this stackoverflow answer, but moogaloop's links don't work. It has be more than a year since Vimeo updated their API.
Is there any way to get a direct link/downloading videos through API/PHP.
For Vimeo PRO Account:
You can get the direct link for any video or all videos in your account. To get the download link for all videos you have to call the following API with your access token.
GET https://api.vimeo.com/me/videos
or you can get the download link for a single video by calling the following API
https://api.vimeo.com/me/videos/{video_id}
In responses, you can find download['link']
For more information go to
Vimeo API Documentation

YouTube data download with cclive & gcap

In a PHP system, my client suggested to download videos AND MAINLY captions from YouTube using the following tools:
cclive
gcap
As I have never heard of these before, my question is does anyone have any experience with them? Both projects seem to be inactive for like one year or so... Do they still work?
Is it possible to download captions for any YT video with them? I have stumbled upon some YT API info that the captions are not available for unauthorized users (i.e. you can only get your own captions if you are authorized with the API)?
Caption tracks can only be accessed via the Data API by the authorized owner of a given video.
The official YouTube Players can access caption data, but they use a different mechanism for accessing that data which is not part of a public API.

Search for a YouTube link in twitter feed?

I wonder if I can search for a tweets that shared a particular YouTube video. And sort out the users who got the most followers sharing the YouTube video. Only using their API and in PHP.
Given that Twitter (and other URL shortening applications) encode the URL, you'll have to do the following:
1) Collect all your tweets with hyperlinks
2) Open the hyperlinks to see if they redirect to Youtube
3) Compile the ID's on the redirects
4) Use the Twitter API to do identify your followers
In short yes, but no.

Is it possible to Implement youtube channels uploaded videos list into website?

What I want to do is, to show uploaded videos list of my youtube channel to website's visitors.
Something like that. (Image take from youtube channel, I want to show exactly this way)
Don't want to create iframe. Can I fetch data from channels exact page with PHP or something else? I have no idea if it's possible with youtube api. Any suggestions?
Yes you can. The videos on a channel are essentially a user's so using the YouTube GData API you can make a call to http://gdata.youtube.com/feeds/api/videos?author=ahmednuaman (my videos for example).

Categories