user3933400
user3933400

Reputation:

Fetch video details on Youtube using API v3 in PHP

How can I fetch video details from Youtube via API v3 in PHP? I need help in getting started with this. I tried this tutorial already but it's not working. http://www.w3resource.com/API/youtube/tutorial.php

I need to search through my site and I will only need to fetch the details such as link, thumbnails, title and the person who uploaded the video.

Upvotes: 10

Views: 13772

Answers (1)

t_yamo
t_yamo

Reputation: 779

ref. https://developers.google.com/youtube/v3/docs/videos/list

You can request from your server as below.
https://www.googleapis.com/youtube/v3/videos?part=snippet&id=XS6ysDFTbLU&key=XXX

XXX is your API key.
If you don't have your API key, you should access Developer Console, and you get API key.
http://code.google.com/apis/console#access
[APIs & auth]-[Credentials]-[Public API access]-[Create new key]-[Server key]
You should set global IP address of your server in "IPS".

If you want to call API from client, you should use [Create new key]-[Browser key] and set your URLs in "REFERERS".

If your question is "I can get data, but I can not parse response.", see documents of library.
https://github.com/google/google-api-php-client

Upvotes: 16

Related Questions