How to get links in comments from the YouTube api following the move to Google+ comments - youtube-api

In the new YouTube Google + comments system how can I retrieve comments that contain links.
For example if someone posts a link to another youtube video as follows:
http://www.youtube.com/watch?v=AZNHuFjnmUo
This gets converted to a link by the google plus system. The title of the video is shown as the text rather that the url. i.e. The html shown within the comments is this:
Francis HATES Google+
However the api for that comment only returns the title of the video which is pretty useless seeing as I want to get the link too. I am guessing that the system converts the url into an <a> tag which is stored in the database but then the api strips out the html when its requested so it only returns the videos title.
I have posted a defect here:
https://code.google.com/p/gdata-issues/issues/detail?id=5500
But that bug list seems to have very little activity going on in terms of responses to issues.
So is there another way to get the data I need?

What you can do while this bug remains is to extract the comment id and use it in the Google+ API with an activities.get request. This will return the full post with all links.
A bit cumbersome since it needs one request for each comment you want to check, but it seems to be the only way while the bug remains.
To take an example from the video you linked in the issue:
This YouTube comment returned by the API includes a YouTube link:
http://gdata.youtube.com/feeds/api/videos/rgkDKeSc-1o
/comments/z12hvvcgxznkufyo304ci1iqlnandzxjpes
You can use the z... ID in a request to the Google+ API:
https://developers.google.com/apis-explorer/#p/plus/v1/plus.activities.get?activityId=z12hvvcgxznkufyo304ci1iqlnandzxjpes
Which includes the full post including links.

Related

Is there a way to access the comments I make on YouTube through the API?

I'm trying to retrieve the comments I've made on YouTube to turn them into Markdown files, but I can't find a way to do it filtering by user in the API documentation.
I thought it would be possible since the Google account has a link for it but when using the parameter "channelID" in the API to list comments as it says in the documentation, it gives back a 400 error.
You are looking for the comments your channel posted, however when using CommentThreads: list with channelId=YOUR_CHANNEL_ID you are listing comments people wrote on your channel, as described the documentation:
channelId
string
The channelId parameter instructs the API to return comment threads containing comments about the specified channel. (The response will not include comments left on videos that the channel uploaded.)
One more time YouTube Data API v3 AFAIK doesn't provide this basic feature.
You have two possibilities:
Use Google TakeOut (make sure to export Comments in YouTube and YouTube Music)
Web-scrap the webpage you provided

YouTube API Search by Tags

I'm trying to add videos to an existing ASP.NET MVC site, and I'd like to show videos from our YouTube channel.
I have added a tag to each video to indicate what page it should appear on. I had thought that I could search our channel by tag on each page to render the relevant video on that page.
I'm trying to exclusively use the API v3, but it seems I can't do this.
I can't use developer tags, because videos are uploaded by multiple users using the standard YouTube front end. This seems like basic functionality, so I'm assuming it's my inexperience with this API.
As an example, our YouTube channel is ChillinWithCharlie. During development, one video is tagged 20141213Cheneys.
I can get all videos in our channel, but is there a way to query the v3 API to retrieve just this video?
I've seen one suggestion here that I retrieve all videos, and filter in code. This feels inefficient, so I'd rather not do this, but I can't even see where the tag is returned with all channel videos, that I could interrogate in code.
It's not just you. There seems to be no specific query parameter to search by tag with API v3.
I would recommend doing a search with your tag in the 'q' (search) parameter, then checking the results to see if the tag exists in the returned snippet->tags property to verify the exact video.
Note YouTube tags are only visible to the video's uploader.
https://developers.google.com/youtube/v3/docs/videos#snippet.tags[]

Disqus API listPosts doesn't include links back to the original page

I am using this API http://disqus.com/api/docs/forums/listPosts/ to get the list of recent comments, but the result from the API doesn't include the links for the content page on my site. I have tried find it in the API pages and no luck. Just curious if anyone knows how to get these links.
After playing around with the console a bit more, found out that in order to get this information, I need to pass "related=thread" in the api param.

Youtube Search Results as Playlist, Need Advise

Hi guys, this is my first time to post on this awesome community so
please bear with me.
I am working with a Wordpress Plugin that can display a Youtube Search Results into Video Playlist.
My settings are:
Keywords
Author
Content- channel/keyword
My first Approach was this:
with this api as reference,
search for the keyword > display the relevant results according to the author as playlist
*I'm in doubt if I this is possible, coding 30%
*I'm not sure where could I use my settings for Content
but then when my coding is in progress I recently bumped an article that says Youtube Search is differrent on Searching a Youtube Playlist
Now I can't continue my coding because I'm not sure If I'm doing it
right. Can you give me some advise with this situation or show me some
similar project/examples?
You don't have to write any YouTube Data API code for this; it's a built-in feature of the YouTube Player.
This blog post has an example of loading a list player that takes its content from the recent uploads of a channel. You can do something similar by setting listType=search&list=SEARCH_TERM, where SEARCH_TERM is whatever string you want to search for (be sure to URL escape it). You can read more in the documentation.

How to add Twitter Expanded Tweets? (was: twitter media preview card for my site?)

I googled a lot about how to make twitter media preview for my website entities if they are linked in a tweet like images below:
Any idea where can I find some documentation about it? Or a tutorial? Is this possible or these media/site previews are hardcoded in twitter?
EDIT:
so, what I need:
If someone links my site on twitter, my widget appear under the tweet, like below:
UPDATE 2012-06-13
It appears this is an Expanded Tweet - -what the requirements are to integrate these expansions into Twitter are do not appear to be displayed - but this sure is interesting.
Nope your in luck. They're not hardcoded into Twitter, they're available in the JSON response. You actually have in your post the word you need to google for entities.
You can add include_entities=1 to the end of most REST api calls and it will give you expanded information about the URL's contained within the JSON. It will split out all the URL's where you can parse out the Youtube links for example. The JSON also includes a special media_url entity but it only works for pictures. In any case, you can still parse out the media easily like youtube with a regex match because you get the URL's split out nicely with this include_entities=1 parameter.
example call :
http://api.twitter.com/1/statuses/user_timeline.json?screen_name=twitterapi&include_entities=1
more documentation : https://dev.twitter.com/docs/tweet-entities
answer edited below based on clarification:
Editing Twitter itself with previews is impossible and it's also ineffective. 75% of traffic to Twitter happens outside of Twitter.com. However the most probable solution to achieving this request would be to download a browser extension.
This extension for example enbales previews of webpages directly in the users stream content preview pane on Twitter.com
https://chrome.google.com/webstore/detail/oijgblonhcagdhfbgjilnpjipmijimmn

Resources