I've been playing around with the google/google-api-php-client. I've noticed that it says "build-failing", but some parts are working as expected, so I've been pressing on with it.
So I have built a search field that queries the YouTube API for videos containing a search string and prints the results. You'll see that I've also hooked up the YouTube Player iFrame API to play the video if it is clicked.
Now these results do contain snippet data (title, description, channelId, etc...), but the item description's are limited to 160 characters and appended with an ellipsis ….
So now in an attempt to get a full description, I am sending another call to the YouTube API. I am calling $youtube->videos->listVideos('snippet',array('id' => '7dR02ebri9c')). The call is successful, but does not contain any snippet data.
I've logged the response to the console so you can see it here:
And printed it here incase the above image does not show.
{"etag":"\"43qFkeEQBKio26KDSq1ZQMzjhSo/3nlK0uyD_p1CFvvGkbiQcGORv5w\"","eventId":null,"kind":"youtube#videoListResponse","nextPageToken":null,"prevPageToken":null,"visitorId":null}
If I run the same request via the YouTube API Explorer, I receive a response complete with snippet data and a full description.
So I ask, is the problem the google/google-api-php-client I am using, the YouTube API itself, or perhaps something else?
Edit: I've found and thought about using madcoda/php-youtube-api instead, and will do-so if all else fails.
I've discovered that google/google-api-php-client was the problem here.
I've had success using madcoda/php-youtube-api instead.
Related
I'm using Youtube API v3 to upload video. At the first time I use, it requires authorization then do upload but there are two videos is created. They are exactly the same but there is no error, the API returns the latest id. I checked in my channel, two videos could be view.
When I try to upload the previous video, another id returns, too, but if I use this, Youtube will show me "This video is a duplicate of another video". Other times, the API works right. Did anyone encounter this problem?
I'm currently using CodeBird to post tweets via PHP on my website. I've been using Bit.ly to post short URLS within those tweets. I would prefer to use the t.co short links that twitter creates but I am unsure how to do this.
\Codebird\Codebird::setConsumerKey("???", "???");
$cb = \Codebird\Codebird::getInstance();
$cb->setToken("???", "???");
$params = array('status' => $VideoTitle.' | Visit -> '.$VideoShortUrl, 'media[]' => 'hdefault.jpg');
$reply = $cb->statuses_updateWithMedia($params);
$array = json_decode(json_encode($reply), True);
Above is the code I use alongside the codebird.php file. Every tweet includes a title, url, and image. I'm looking to have the link I post (which is always 28+ characters) replaced with the twitter t.co short link.
I've read the twitter API documentation and other related questions on SOF but still have come up empty handed. I know twitter creates the link as soon as I post a tweet cause the array returns the short URL with all the other tweet details instantly.
The Twitter API says:
Links will be wrapped when Twitter receives a Tweet using POST statuses/update or a direct message using POST direct_messages/new.
I was thinking maybe codebird's wrapper wasn't unwrapping the links when it was returning the data, but I couldn't find anything there either. Does anyone know how I would go about replacing my URL with the t.co URL in the process of posting a tweet?
p.s
I've read that sometimes the short url creation 'could' be delayed, but none of my links are being changed. Also on a side note almost all the tweets are under 140 characters even with the long URL.
Every link posted to Twitter gets wrapped in the API. You don't need to do anything specific - just include a URl in your status.
When Twitter displays the tweets on its website, it will often show the original URL, but when you click on it, it goes via t.co
Can you show us an example of one of your Tweets which doesn't have a t.co link?
I work with Facebook API SDK. I'm trying to get all public photos using https://graph.facebook.com/search?access_token=xxxx|xxxxx&q=%23hashtag&type=post
But I have a problem: result contains only shared photos in first account. When i'm posting photo without share, search not found it.
Otherwise, I have another account where I'm posted photo and share it, but photo is not found too.
Who knows, how can I get all public photos with hastag using FQL or graph search
Addition:
Few days ago - facebook search is not working
After discussing with facebook developers, I got the answer:
Facebook API does not support searching for hashtags.
%23 is just the URL encoded version of a # which gets decoded on a
server generally so it still won't work. For example if I wanted to
search for #YOLO I would just say q=YOLO with no # or it's URL encoded
form.
It's just something that the api doesn't support at the moment
Facebook has officially deprecated the post search type. Im not sure when exactly but I can tell you I tried today (10/15/2014) and its a no go.
I noticed some inconsistencies between the data retrieved via the Youtube API v3 and what Youtube shows accessing directly the website.
Sometimes, the data returned via the playlistitem list contains a lower number of items (videos) than the playlist shown in the website.
This happens when the playlist contains deleted videos. In fact, at times, a video marked as deleted on youtube's playlist, it is still reported in the returned data of a playlistitems call, other times it is not, leading to a playlist having 2 different sizes (i.e. 20 videos on the website and only 18 returned via the api).
This is puzzling for my users when they compare the playlists on youtube and in my application, as they see 2 different results...
Anyone knows how to handle playlists with deleted videos? Or how to retrieve the same data as it is shown in the website?
I'm using php and youtube v3 apis and youtube's php libraries if it is relevant.
I think it is a bug in the YouTube API version 3.
You should check if it is already reported as a bug and if not you can file it yourself here:
https://code.google.com/p/gdata-issues/issues/list?q=label:API-YouTube
if you decide to file it as a bug you should mention a playlistID that shows the problem.
I have noticed it too. However, it does not bother me.
In my case:
Using API version 3. The response is missing one or more items.
Missing playlist items always appear as DELETED on youtube.com
It happens on some playlists but not all.
The playlist is PUBLIC and contains only videos from other channels.
I'm putting together an application in facebook, part of which requires a user to input a bunch of information into a form, including a video and a number of text fields.
For my application, I'm using a combination of HTML, PHP, mySQL and Javascript.
I want to be able to upload the users video file to facebook using the PHP SDK in the same page as I am inserting their info into my database. I want something similiar to the photo solution here: Exception when uploading photo with Facebook Graph API. But I'm not sure what the array key should be for the video itself.
Can any give me any ideas?
My apologies,
I realized that the solution I linked to works. However, you have to give facebook time to process the video, otherwise the graph api replies false.