how to grab geo-data location from gramfeed? - data-visualization

I'm kind of new to all the programming language, and i want to grab the geo-locations for academic research in purpose of visualization data.
There is any simple way for this? or simple tutorial how to do this? i need to extract the geo-locations from the map to csv\json\xls file

The readme here (https://github.com/Instagram/python-instagram) is a tutorial.
For example to authenticate with the API use:
from instagram.client import InstagramAPI
access_token = "YOUR_ACCESS_TOKEN"
client_secret = "YOUR_CLIENT_SECRET"
api = InstagramAPI(access_token=access_token, client_secret=client_secret)
Then you could locations information as with these three queries:
api.location(location_id)
api.location_recent_media(count, max_id, location_id)*
api.location_search(q, count, lat, lng, foursquare_id, foursquare_v2_id)
The docs for the location "endpoint" of this API (https://www.instagram.com/developer/endpoints/locations/).
Essentially the above commands could send a request like:
https://api.instagram.com/v1/locations/search?lat=48.858844&lng=2.294351&access_token=ACCESS-TOKEN
The Instagram API response would be:
{
"data": [{
"id": "788029",
"latitude": 48.858844300000001,
"longitude": 2.2943506,
"name": "Eiffel Tower, Paris"
},
{
"id": "545331",
"latitude": 48.858334059662262,
"longitude": 2.2943401336669909,
"name": "Restaurant 58 Tour Eiffel"
},
{
"id": "421930",
"latitude": 48.858325999999998,
"longitude": 2.294505,
"name": "American Library in Paris"
}]
}
Python can certainly export this data into one of the file types you mentioned. Note that there is also some really nice plotting capabilities, take a look; (http://matplotlib.org/basemap/users/examples.html). The benefit of the wrapper is that you can directly interact with the response data. It would be like a Python dict object.

Related

Get a list of cities suggestions from text with HERE Geolocation API

I'm trying to find the way to get a list of cities names suggestions from a text written by user. I've managed to do it using the HERE Geocoder Autocomplete API but I would like to use the latest Rest API version Geocoding and Search API v7.
Does the 7 version substitute the other APIs?
Is there a way to find cities names suggestions in v7 API?
Please check the usage on GS V7 Autosuggest, it can be used for both address and POI, details in here.
For example, API call https://autosuggest.search.hereapi.com/v1/autosuggest?at=52.5199813,13.3985&limit=5&q=res&apiKey=apiKey will get response like below.
You should be able to parse and get the address from address:city field.
"items": [
{
"title": "Hackescher Hof",
"id": "here:pds:place:276u33db-fb00197ffa5041b2b656ea3d23145dca",
"resultType": "place",
"address": {
"label": "Hackescher Hof, Rosenthaler Straße 40, 10178 Berlin, Deutschland",
"countryCode": "DEU",
"countryName": "Deutschland",
"state": "Berlin",
"county": "Berlin",
"city": "Berlin",
"district": "Mitte",
"street": "Rosenthaler Straße",
"postalCode": "10178",
"houseNumber": "40"
},

Latest one video uploaded in youtube channel

I need to show the thumbnail of the latest video on my youtube channel on my website and add a link to that video. While using the API parameter date it's showing the first video in that channel. Instead of that, I need the last published video details how to solve this
This is what I used as I require only one last video
https://www.googleapis.com/youtube/v3/search?key=[key]&channelId=[channel-id]&part=snippet,id&order=relevance&maxResults=1
(option 1)
You could try replacing order=relevance with order=date
try:
https://www.googleapis.com/youtube/v3/search?key=[key]&channelId=[channel-id]&part=snippet,id&order=date&maxResults=1
(option 2)
You could also try using publishedAfter command (which takes a year-month-day format).
Example: publishedAfter=2019-03-25T00:00:00Z (because yesterday was March 25th).
try:
https://www.googleapis.com/youtube/v3/search?key=[key]&channelId=[channel-id]&part=snippet,id&publishedAfter=2019-03-25T00:00:00Z&order=date&maxResults=1
(option 3)
Use your programming language to fetch / read the HTML source-code of the channel's uploads page. The first thumbnail listed after gridVideoRenderer is the latest, along with relevant URL.
Example steps:
1) Go to user's uploads page and use "view source" option to see the HTML text (source code).
This text is what your programming language should show you when you http request the link of the channel's uploads.
https://www.youtube.com/user/MARVEL/videos
2) After acquiring (or viewing) the source code
From there find position of the word gridVideoRenderer.
Then starting after position, now find the first occurence of word "url":".
That is the URL. Extract manually by hand or write code to do it automatically.
PS: Replace any unicode in the link, like \u0026 with &.
https://i.ytimg.com/vi/QuP7V2gKgPI/hqdefault.jpg?sqp=-oaymwEZCPYBEIoBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLDBeSfAIiCdLDKtA8h2G-AZqk-xhQ
I tried "option 1" with my own Key, and got the correct response as far as which "video" from the "Channel" - NO THUMBNAILs, just references to it/them, code follows:
{
"kind": "youtube#searchListResponse",
"etag": "EymHvUd1w4o13UcSUT0C9YINu3o",
"nextPageToken": "CAEQAA",
"regionCode": "US",
"pageInfo": {
"totalResults": 181,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#searchResult",
"etag": "23QGL4Y9Du8EXMntX5ZNdr1F7_k",
"id": {
"kind": "youtube#video",
"videoId": "RRQjUvoSuKU"
},
"snippet": {
"publishedAt": "2022-11-13T15:09:07Z",
"channelId": "UCbhMYK2QQXgHjgnMN3zegRQ",
"title": "All Things Closely",
"description": "Luke 1:1-4.",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/RRQjUvoSuKU/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/RRQjUvoSuKU/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/RRQjUvoSuKU/hqdefault.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "Restoration Church Homestead",
"liveBroadcastContent": "none",
"publishTime": "2022-11-13T15:09:07Z"
}
}
]
}
THAT's all that showed on a browser page, no Thumbnails-just code, but could not figure out how to get any code in the string to PLAY that video ...
any ideas?
I would love to just have it as a LINK rather than any other scripts loaded on the server. I'm missing something, probably simple I bet, to get the returned video related to the data to play.

Ruckus SmartZone API

I am having issues when trying to create a Zone using the API.
I can create the zone with the basic info, but as soon as I want to add another property (specifically "location") I get an error.
This is my dataset I use for the POST
def id_prov ={
"domainId": "$DomainId",
"name": "$ZoneName",
"login": {
"apLoginName": "xxxxx",
"apLoginPassword": "xxxxx"
},
"description": "$jira_summ",
"version": "3.5.1.0.1010",
"countryCode": "ZA"
"location": "$CalledStationName_val",
}
The API creates everything until I either include the "location" property in the original POST or if I try a PUT or PATCH atferwards.
Result value:
{"message":["object instance has properties which are not allowed by the schema: [\"location\"]"],"errorCode":101,"errorType":"Bad HTTP request"}
Anyone come across this or have any ideas on how to get this working?
Thanks
A comma is required after "countryCode": "ZA". The post payload should look like this:
def id_prov ={
"domainId": "$DomainId",
"name": "$ZoneName",
"login": {
"apLoginName": "xxxxx",
"apLoginPassword": "xxxxx"
},
"description": "$jira_summ",
"version": "3.5.1.0.1010",
"countryCode": "ZA",
"location": "$CalledStationName_val",
}

How to Get Twitch Video Thumbnail URL?

Video-sharing websites such as Youtube has a endpoint for video thumbnails
Example: http://img.youtube.com/vi/youtube_id/default.jpg
where youtube_id = the id of the video
So I can just do
<img src="http://img.youtube.com/vi/youtube_id/default.jpg">
with no problem
Does twitch have something like this as well?
Update 2018
Twitch requires you to use its API so you can get access to video thumbnails. Apparently, this is because the URL of the thumbnails may change
Here is a simple guide how to get access to a twitch video thumbnail
You have to get access to Twitch dev API - to do this you need to register an account at https://glass.twitch.tv
After registering an account you must then create an App from your twitch dev dashboard
After creating the App, you will be given a Client ID to be used for that app - note that the app is the one which will be using the twitch API (for example, your website)
You can now pass the client_id as a query string parameter to https://api.twitch.tv/kraken/videos/106400740?client_id=xxxxxxx where 106400740 is the video id (note that 'kraken' here is constant - not sure of the origin behind its name) - note that the request will return a JSON object which contains an error message if you do not include a client_id
The request will return a JSON object which looks something like:
{
"title": "Door 5 vs Tilted Gamers",
"description": "COOL Games: Killing Spree first match # Mineski. Grove, Los Ba\u00f1os",
"description_html": "COOL Games: Killing Spree first match # Mineski. Grove, Los Ba\u00f1os<br>",
"broadcast_id": 1,
"broadcast_type": "upload",
"status": "recorded",
"language": "en",
"tag_list": "",
"views": 4,
"created_at": "2017-11-08T03:13:12Z",
"published_at": "2017-11-08T04:33:37Z",
"url": "https:\/\/www.twitch.tv\/videos\/188543310",
"_id": "v188543310",
"recorded_at": "2017-11-08T03:13:12Z",
"game": "Dota 2",
"length": 2436,
"preview": "https:\/\/static-cdn.jtvnw.net\/s3_vods\/esportsdotcool\/188543310\/3534ab8c-bf7d-4c8a-b502-c406825bf75f\/thumb\/index-0000000000-320x240.jpg",
"animated_preview_url": "https:\/\/vod-storyboards.twitch.tv\/esportsdotcool\/188543310\/3534ab8c-bf7d-4c8a-b502-c406825bf75f\/storyboards\/188543310-strip-0.jpg",
"thumbnails": [
{
"type": "generated",
"url": "https:\/\/static-cdn.jtvnw.net\/s3_vods\/esportsdotcool\/188543310\/3534ab8c-bf7d-4c8a-b502-c406825bf75f\/thumb\/index-0000000000-320x240.jpg"
},
{
"type": "generated",
"url": "https:\/\/static-cdn.jtvnw.net\/s3_vods\/esportsdotcool\/188543310\/3534ab8c-bf7d-4c8a-b502-c406825bf75f\/thumb\/index-0000000006-320x240.jpg"
},
{
"type": "generated",
"url": "https:\/\/static-cdn.jtvnw.net\/s3_vods\/esportsdotcool\/188543310\/3534ab8c-bf7d-4c8a-b502-c406825bf75f\/thumb\/index-0000000012-320x240.jpg"
},
{
"type": "generated",
"url": "https:\/\/static-cdn.jtvnw.net\/s3_vods\/esportsdotcool\/188543310\/3534ab8c-bf7d-4c8a-b502-c406825bf75f\/thumb\/index-0000000018-320x240.jpg"
}
],
"fps": {
"144p30": 29.999544341896,
"360p30": 29.999544341896,
"480p30": 29.999544341896
},
"resolutions": {
"144p30": "256x144",
"360p30": "640x360",
"480p30": "852x480"
},
"channel": {
"name": "esportsdotcool",
"display_name": "esportsdotcool"
},
"_links": {
"self": "https:\/\/api.twitch.tv\/kraken\/videos\/v188543310",
"channel": "https:\/\/api.twitch.tv\/kraken\/channels\/esportsdotcool"
}
}
Under the thumbnails array you can find the url to the video.
PS: As you can see, the thumbnails array has length of 4 - at this point I think this is because of the different sizes of the image that the author of the video can put up

Xbmc Database Path

I am working with XBMC. I have installed XBMC in my system(Windows 7, 32 bit). Xbmc is working fine in my system. I have developed an application in order to control the Xbmc remotely from Ipad. In order to retrieve the music files or video files from Xbmc, I am unable to. By searching the forums of xbmc, I found that we can write an sql query to get them out. But, the thing is I am unable to make out where the database is located in my system. Someone help me out where I can find it.
Regards,
Sushma.
The database itself
By default the location of the database is that described on the wiki page XBMC databases
but the actual location can be changed by the user, or a different database technology can be used entirely.
The settings that would affect this are located in advancedsettings.xml.
But in general it is advised by the XBMC developers to never access the database directly.
JSONRPC
In order to help with interacting with the database XBMC has supported the JSONRPC queries, the one downside of these is that XBMC needs to be running at the time to respond to these queries. The major advantage is that it XBMC will find the database for you and expose access to it with a common interface.
JSONRPC support was first added to XBMC in "Darhma" (v10), became really useful in "Eden" (v11) and will support almost everything possible in "Frodo" (v12). Information about the use of JSONRPC can be found in the wiki.
An example
In this example I'm assuming that you are targeting "Eden", the current stable release of XBMC. Also I have formatted the following with new lines, these are not required and are not present in the response from XBMC.
Request
If you were to use JSONRPC the request you would need to send would look something like:
{
"jsonrpc": "2.0",
"method": "VideoLibrary.GetMovies",
"params": {
"properties": [
"title",
"year",
"file"
],
"limits": {
"start": 0,
"end": 2
}
},
"id": 1
}
Note: If you wanted different information about each movie you could use other properties listed here.
*Note: You probably want to omit the "limits" part to get all movies.*
Responce
The response to this would be something like:
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"limits": {
"end": 2,
"start": 0,
"total": 47
},
"movies": [
{
"label": "Label for movie",
"movieid": 1,
"title": "Title of movie",
"year": 2012
},
{
"label": "Label for another movie",
"movieid": 2,
"title": "Title of another movie",
"year": 2010
},
{
"label": "Label for a third movie",
"movieid": 3,
"title": "Title of a third movie",
"year": 2012
}
]
}
}
What to do now?
You have a choice at this point, you can either:
Add "file" to the list of properties, this will return the "file" property, the location of the video file.
Use JSONRPC to tell xbmc to play a movie.
Using this method is best when you don't want to play the file locally (on the iPad) but instead on XBMC.
Playing a movie on XBMC via JSONRPC
This is quite simple, use the "movieid" you received earlier in the following request:
{
"jsonrpc": "2.0",
"method": "Player.Open",
"params": {
"item": {
"movieid": 2
}
},
"id": 1
}
Lastly I would note that there are equivalent commands for TV episodes as shown for movies.