问题
Although the youtube-api, v3, allows you to make a request for videos that come from a particular area (for example, by specifying the location and the radius), it appears that the resulting information about the videos does not contain location information. That is, you can't get the reported lat/long of the video itself.
A query for a specific location would look like this: https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&key=[key]&location=37,5%2C-120.5&locationRadius=2km&maxResults=5
Here's the description of the information returned. https://developers.google.com/youtube/v3/docs/search#top_of_page
So, is that correct? Is there no longer any way to find out the lat/long information of a video that is returned in a query?
回答1:
OK, I figured this out. The location query will only return the various snippets of information about the videos, that is true. However, you can then look at individual videos in more depth to find their locations. For example:
https://www.googleapis.com/youtube/v3/videos?part=recordingDetails&key=[key]&id=HiFnDoUiaqg
will return recording information including: "recordingDetails": { "location": { "latitude": 37.50973, "longitude": -120.49805, "altitude": 0.0 },
So it's a 2-step process. You find the list of videos returned by the location query, and then you look at the detailed information for those videos.
来源:https://stackoverflow.com/questions/31993066/youtube-api-v3-geolocation-information