How to build url to yelp review using yelp API? - api

How to build url to yelp review using yelp API?
"reviews": [
{
"excerpt": "This is by far my favorite breakfast food. They have the best plain grits and one of the best omelets I\u0027ve ever had. The grits require no extra seasoning,...",
"id": "N95_f0ssLhVk-3_adcm0HA",
"rating": 5.0,
"rating_image_large_url": "https://s3-media3.fl.yelpcdn.com/assets/2/www/img/22affc4e6c38/ico/stars/v1/stars_large_5.png",
"rating_image_small_url": "https://s3-media1.fl.yelpcdn.com/assets/2/www/img/c7623205d5cd/ico/stars/v1/stars_small_5.png",
"rating_image_url": "https://s3-media1.fl.yelpcdn.com/assets/2/www/img/f1def11e4e79/ico/stars/v1/stars_5.png",
"time_created": 1.456714839E9,
"user": {
"id": "v6q8B9nEHBK25EuNIUF09g",
"image_url": "http://s3-media4.fl.yelpcdn.com/photo/zzXwod9kRw5BC-OZn2S6Dg/ms.jpg",
"name": "Ashley M."
}
}
I can see the review information here, but I can't see link to the review to do smth like "read more". Can someone help me with it?

The solution will be smth like that:
url.substring(0, url.indexOf("?")) + "?hrid=" + reviewId;

Related

Branch.io event logging

I am following the below link for logging ecommerce event in branch.io
https://github.com/BranchMetrics/branch-deep-linking-public-api#logging-commerce-events
I am using the same request as mentioned in the link.
but the details are not getting captured in branch.io dashboard.
I am getting "branch_view_enabled": false as a response.
Please help me out if there is any issue in settings ? or explicitly I will have to do something for seeing the events in the dashboard.
A response will be highly appreciated!
I tried it like this
new BranchEvent("Event Name")
.addCustomDataProperty("Key", "Value")
.logEvent(this);
And it shows the event name on the branch dashboard under summary. And my log shows that internally it was targeting the v2. I am sending it through android
https://api.branch.io/v2/event/custom
This is Jackie from Branch.
We are not yet supporting v2/events for commerce yet which is why you weren't able to track it on the dashboard.
Moving forward, please use v1 event request following our official documentation here. I've also included a sample commerce request for your information. In the meantime, we will update the commerce information on our github page so as not to cause any confusion.
curl -X POST https://api.branch.io/v1/event \
-d '{
"branch_key": "your_Branch_key",
"identity": "222",
"event": "purchase",
"metadata": {
"hello": "world",
"custom_data": "this"
},
"commerce_data": {
"revenue": 50.0,
"currency": "USD",
"transaction_id": "foo-transaction-id",
"shipping": 0.0,
"tax": 5.0,
"affiliation": "foo-affiliation",
"products": [
{
"sku": "foo-sku-1",
"name": "foo-item-1",
"price": 45.00,
"quantity": 1,
"brand": "foo-brand",
"category": "Electronics",
"variant": "foo-variant-1"
},
{
"sku": "foo-sku-2",
"price": 2.50,
"quantity": 2
}
]
}
}'
Hope this helps. Please feel free to contact us directly if you have any other questions or issues at support#branch.io.
Best,
Jackie

how to grab geo-data location from gramfeed?

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.

Is there any work around on fetching twitter conversations using latest Twitter REST API v1.1

I am working on a project where the conversation of a twitter user needs to be retrieved. For example i want to get all the replies of this tweet of BBC World Service. Using the REST API v1.1 i can get the timeline (tweet, re-tweet) of a twitter user. But i did not find any documentation/working work around on fetching replies of a specific tweet. Is there any work around on getting the replies of a specific tweet at all?
There is no API call to get replies to a specific tweet. You can, however, cheat!
Using the Search API you can construct a search query which is:
In reply to #bbcworldservice.
Occurred after the tweet was posted.
Optionally, before a specific date / time.
So, in this case, something like
https://api.twitter.com/1.1/search/tweets.json?
q=%23bbcworldservice&
since_id=489366839953489920&
count=100
You'll get a list of Tweets (up to 100). You will then need to search them for in_reply_to_status_id_str and see if it matches the status you're looking for.
The TwitterAPI v2 allows you to retrieve the entire conversation thread using just the conversation_id in search. (In v1.1 you had to write custom code to build it)
Replies to a given Tweet, as well as replies to those replies, are all included in the conversation stemming from the single original Tweet. Regardless of how many reply threads result, they will all share a common conversation_id to the original Tweet that sparked the conversation. Using the Twitter API v2, you have the ability to retrieve and reconstruct an entire conversation thread, so that you can better understand what is being said, and how conversations and ideas evolve.
Example:
curl --request GET \
--url 'https://api.twitter.com/2/tweets?ids=1225917697675886593&tweet.fields=author_id,conversation_id,created_at,in_reply_to_user_id,referenced_tweets&expansions=author_id,in_reply_to_user_id,referenced_tweets.id&user.fields=name,username' \
--header 'Authorization: Bearer $BEARER_TOKEN'
Response will be like
{
"data": [
{
"id": "1225917697675886593",
"text": "#TwitterEng",
"created_at": "2020-02-07T23:02:10.000Z",
"author_id": "2244994945",
"in_reply_to_user_id": "6844292",
"conversation_id": "1225912275971657728",
"referenced_tweets": [
{
"type": "quoted",
"id": "1200517737669378053"
},
{
"type": "replied_to",
"id": "1225912275971657728"
}
]
}
],
"includes": {
"users": [
{
"username": "TwitterDev",
"name": "Twitter Dev",
"id": "2244994945"
},
{
"username": "TwitterEng",
"name": "Twitter Engineering",
"id": "6844292"
}
],
"tweets": [
{
"id": "1200517737669378053",
"text": "| ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄|\n don't push \n to prod on \n Fridays \n|___________| \n(\\__/) ||\n(•ㅅ•) ||\n/   づ",
"created_at": "2019-11-29T20:51:47.000Z",
"author_id": "2244994945",
"conversation_id": "1200517737669378053"
},
{
"id": "1225912275971657728",
"text": "Note to self: Don't deploy on Fridays",
"created_at": "2020-02-07T22:40:37.000Z",
"author_id": "6844292",
"conversation_id": "1225912275971657728"
}
]
}
}
For more info checkout twitter API Conversation

Pinterest board list

I am looking for a way to get the list of board names from a given username. I know pinterest already provides rss for all the pins from a given user and for all the pins from a given pinboard.
All Pins from a given user: pinterest.com/[user]/feed.rss
All pins from a given user and board: pinterest.com/[user]/[board-name]/rss
Now I need a way to get the list of boards from a given user, not the pins. I know there is a way to do it because -> pinreach.com does it.
Thank you in advance :)
RSS feed only has 25 pins. To get boards or all the pins, you have to crawl the site. There is no way around it.
Here is another Unofficial API with Documentation for Pintrest
http://pinterestapi.co.uk/
Hey you can check out this unofficial Pinterest API, you can search boards by username - https://www.mashape.com/ismaelc/pinterest-1#endpoint-Show-User-Boards
Sample result below:
{
"body": [
{
"name": "Books Worth Reading",
"href": "http://pinterest.com/ismael/books-worth-reading/",
"num_of_pins": 6,
"cover_src": "http://media-cache-ec7.pinterest.com/222x/0c/31/22/0c3122735319edbf9b8aae28c9b22f86.jpg",
"thumbs_src": [
"http://media-cache-ec6.pinterest.com/75x75/2a/2d/7b/2a2d7b6f20f7518269b310b25d876810.jpg",
"http://media-cache-ec4.pinterest.com/75x75/e6/05/05/e6050519c5686ae27ad649500965f39c.jpg",
"http://media-cache-ec5.pinterest.com/75x75/07/64/c3/0764c392bae2b073c4c862a6503f09d6.jpg",
"http://media-cache-ec4.pinterest.com/75x75/61/35/0a/61350ab6eb4bb0b0d09f7c191bf30d55.jpg"
]
},
{
"name": "My Style",
"href": "http://pinterest.com/ismael/my-style/",
"num_of_pins": 0,
"cover_src": false,
"thumbs_src": false
},
{
"name": "For the Home",
"href": "http://pinterest.com/ismael/for-the-home/",
"num_of_pins": 0,
"cover_src": false,
"thumbs_src": false
},
{
"name": "Favorite Places & Spaces",
"href": "http://pinterest.com/ismael/favorite-places-spaces/",
"num_of_pins": 0,
"cover_src": false,
"thumbs_src": false
}
],
"meta": {
"count": 4
}
}
You can do this now using the Official Pinterest API using the hook:
https://api.pinterest.com/v1/me/boards/?access_token=********&fields=id%2Cname%2Curl
First, you will need to authenticate and get an acce3ss token.
The getting started doc do a good job at explaining how. https://developers.pinterest.com/docs/api/overview/

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.