Is there a way to simply query the YouTube Data Api for information about a url? - youtube-api

It seems like pretty common problem/question on here to ask how to parse a YouTube video/user/channel/playlist url; with a lot of the answers being partial or outdated regex solutions (Meaning they don't support legacy urls or newer features like handles). Which made me wonder..
Can I simply just ask the v3 Youtube Data Api if a url is valid; then have it return any relevant information? (similar to doing a search w/the api, it'll tell you the type, id, etc.)
As far as I can tell from the reference it's not entirely possible.
The closest I could find was doing a search with the url as the query, but this unsurprisingly led to getting a list with somewhat unpredictable results.

Related

Youtube API v3 category topics

Hey guys I'm not having an issue with the API directly, but with the documentation. I can make an API request and get the video topic details just fine, but I am looking for a master list of all topics.
According to the documentation the old style of topics that you can see here was depreciated in 2017 and replaced with Wikipedia articles. This is fine and a little better for my use case but I would like to get a list of all options. The documentation says
A list of Wikipedia URLs that provide a high-level description of the video's content.
which is not especially helpful haha. I think I found the Wikipedia Source for all music genres, and it looks like they are just using the "main" genres but I would like to confirm that. I also found this list of topics that looks similar but is from the natural language API documentation instead of the YouTube API documentation.
I could try and brute force it but that would require a considerable amount of effort with no real way to confirm my results. I also found this API but it just returns the top level categories.
I am also really only interested in the music categories.

search error for YouTube EDU lectures

We will provide YouTube EDU contents in our application.
I used the below API for querying the lectures in the category, and it's work well.
- http://gdata.youtube.com/feeds/api/edu/lectures?category=39&v=2
I'd like to search EDU lectures including specific keyword.
First, I used the q=keyword method, but it's not work with HTTP 403.
- http://gdata.youtube.com/feeds/api/edu/lectures?category=39&v=2&q=keyword
Second, I used the query=keyword method, it's work with out error, but the result was same without it.
- http://gdata.youtube.com/feeds/api/edu/lectures?category=39&v=2&query=keyword
Please, let me know how to query the relevant EDU content including specific keyword.
Unfortunately search is not supported with these feeds. The only thing you could try doing is filtering, using the partial response protocol in YouTube Data API V2 (https://developers.google.com/youtube/2.0/developers_guide_protocol_partial). It is rather restrictive as far as operands are concerned so I am not sure it will fit your use case.
Another idea is to look to YouTube Data API V3 and Topics API. It is not a direct replacement for the EDU feeds in v2, but perhaps it will be a good potential source for content in your application.
For educational content, you can fetch the video category using:
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.videoCategories.list?part=snippet&regionCode=US&_h=4&
then search within a category:
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list?part=snippet&q=euler's%252Btheorem&type=video&videoCategoryId=27&_h=1&
With the search results you can learn about topic IDs for the videos, for example: VRcX9Fzu1Jo
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.videos.list?part=snippet%252C+topicDetails&id=VRcX9Fzu1Jo&_h=3&
Once you know the topic IDs, you can search for other relevant content. In this example, the topic ID is /m/0382k:
http://www.freebase.com/m/0382k - "Graph theory"
Other videos on this topic:
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list?part=snippet&topicId=%252Fm%252F0382k&type=video&_h=4&
More information about searching by topics: https://developers.google.com/youtube/v3/guides/searching_by_topic

Searching Twitter feeds

I'm looking to take information from Twitter feeds such as removed posts. Is it possible to do this through some sort of string match search by looking for keywords, that is, "this post removed"?
This is for an Arduino project.
It should be. Twitter just turned off their old API, though, so as long as you're willing to get an API key, you should be fine (https://dev.twitter.com). Grab the data with loadBytes or loadStrings called on the API URL and then start walking through the data you got back (http://processing.org/reference/loadStrings_.htm) -- which in the new API will be JSON. You can use a JSON library to turn that into an actual object, but frankly if you want to do text matching, which you do, then there's really no need for Object repacking.

Is it possible to get the YouTube author name for a video using the v3 api?

So I'm working on switching to using the v3 version of the YouTube api (which is so much better it's like a completely different product), but I'm either missing something or it is ...
Being able to fetch an arbitrary list of videos, and their details, in one call is going to make life significantly better, but in the videos list method, the the video details "snippet" contains the "channelId", not the "author".
I've spent quite a bit of time looking through the documentation, but can't find any way of getting from a channelId to the human readable author name.
How am I expected to map a video to an author?
It's not possible to get back a display name (either legacy YouTube name or Google+ name) for a channel as part of the video.snippet response. You need to take the channelId and perform a channels.list(id=channelId1,channelId2,...,part=snippet) operation to get that information. The good part is that you can pass in up to 50 channel ids in a single call.
This sort of separation of information into different resources with ids effectively serving as keys linking the resources was a deliberate decision. The engineering team is aware that it will require developers to make an additional API call, but they're in favor of that design.
At the same time, the API is still in an experimental release, and if you have any feedback about using the API while doing real-world development, feel free to open a feature request in the issue tracker. If enough people give feedback about a certain aspect of the API, that could factor in to the final revision's design.
The accepted answer may have been correct at the time of writing, but as of 2/2018 the snippet part now includes a channelTitle property.

Is there a URL is can use to search for an image and returns the first found image?

I want to use a URL to search for a car by its name & model and have the first image hit returned. Is there a way to achieve this? I've looked at Google & YAHOO, but they return more than I wish for.
All I need is my request to be redirected to the URL of the first found image....
One way to obtain a relevant imagine (not equal to the top hit on Google), is:
http://( Type any keyword here ).jpg.to
For example:
http://dog.jpg.to
http://biting_dog.jpg.to
http://mercedes_benz.jpg.to
I know you mentioned Yahoo didn't work, however we are utilizing a Yahoo API in a very similar context successfully. Check out the BOSS image search API. One of the reasons we originally went with BOSS was that it does not have any daily limits. The image search API also lets you filter, indicate size, and more. The results are returned in XML.
With all that being said, if we had to do it over, we would go the Bing API route, as Bing has a brighter future than Yahoo and has very similar, if not better, API. It looks like it can return results in XML, JSON, and SOAP.
EDIT:
After seeing you were JUST looking for a URL, I tried all the three major search engines and the following URL was the closest I could come to what you decribed: http://www.bing.com/images/search?q=car&view=detail&first=1
I'm afraid the only way to get exactly what you are looking for 100% client side would to be to utilize the Bing API with a jsonp result and then manipulate the DOM via Javascript. Check out this code sample for a rough start.
Bing has a pretty easy to use web search API. You can pass it a URL with various parameters and it will return an XML result. The two parameters you would be interested in would be SourceType (=Image) and ImageRequest.Count (=1).
However, you would need to parse the XML because it won't just give you back the image data.

Resources