Instant Video results - amazon-web-services

I am querying Amazon's Product Advertising API for Instant Video (streaming) results. Everything is working fine -- except that there is some missing information:
Descriptions are not included in results. For example, on Amazon's website the movie "Food, Inc" (http://www.amazon.com/Food-Inc/dp/B002VRZEYM) has the description "An unflattering look inside America's corporate controlled food industry.". When queried via the API, however, no description is returned at all.
Titles of TV shows are not included in results. For example, if you search for the 2nd episode of season 1 of Arrested Development (called "Top Banana") on Amazon's website (http://www.amazon.com/gp/product/B000N2VRJ8), you will get the full name of the TV show, season #, episode #, and episode name. When queried by the API, however, only the episode name is returned.
Does anyone know of a solution to these problems? FYI, the nodeId I am using for my search is 2858778011.

In order to get more details, you'll need to set the ResponseGroup parameter in your request. See the ResponseGroup section of the ItemLookup documentation to see the different Response Groups that you can use.
For example, setting the ResponseGroup parameter to Large or Medium or Small or even ItemAttributes will give you the description:
An unflattering look inside America's corporate controlled food industry.
for Food, Inc (B002VRZEYM) and the Title:
Top Banana
for Arrested Development season 1 episode 2 (B000N2VRJ8).

I had the same problem, while trying to query the Amazon API for Prime Instant Video content. Although this question is kinda old, there are probably some people like me who are interested in a detailed answer, especially for the second part (2.).
Like Jonathan Spooner already said, you have to set a response group
that returns the data you're interested in. Official documentation: Response Groups - Product Advertising API.
In your case, I think, the ResponseGroup Small should do.
If you want to get the title of a TV show, which contains a certain episode, you have to set the response group RelatedItems in your request, too (you can set multiple response groups in one request). You will also have to name a RelationshipType, otherwise the request will fail. For Episode -- Season - Relationships you choose Episode.
With RelatedItems, the result will contain a node named <RelatedItems>. You will find the season item in there, which's title should be something like " Arrested Development - Season 1 [HD]".
Note: If you really just want the TV show title, you could either parse the season name for it or you could make another ItemLookup with the seasons ASIN: set the response group RelatedItems again, but this time with RelationshipType=Season. This will return Season - TV Series - Relationships. The related item will contain the TV Show in general. (But the title could have a suffix like [HD] anyway)
Here you have a list with all relationship types: Relationship Types - Product Advertising API

Related

What is EVENT_TYPE and EVENT_VALUE in Amazon Personalize?

I am creating a recommendation engine using Amazon Personalize. I have to send it following data for it,
USER_ID,ITEM_ID,EVENT_TYPE,EVENT_VALUE,TIMESTAMP
I don't understand what EVENT_TYPE and EVENT_VALUE is in it.
Short explanation
EVENT_TYPE, EVENT_VALUE is optional, if you are just starting with AWS Personalize, you can skip them for now.
EVENT_TYPE is event type of Interaction stored in dataset. Interaction is interaction of User with Item.
EVENT_VALUE is value of event of Interactions.
Maybe example will make it more understandable:
USER_ID - YouTube user ID
ITEM_ID - YouTube video
EVENT_TYPE - video_score, User liked or disliked the Video
EVENT_VALUE - 1 for like and -1 for dislike
TIMESTAMP - When did User watched the Video
Long explanation
Let's start from the beginning, in AWS Personalize you have 3 different types of datasets:
Users
Items
Interactions
The content of datasets depends on your use case, for example, if you want to make video recommendations for user using Video sharing platform, then your datasets will probably contain data looking like this:
Users: USER_ID, USER_NAME, USER_LAST_LOGIN [...] etc.
Items: VIDEO_ID, VIDEO_CATEGORY, VIDEO_VIEWS [...] etc.
Interactions: USER_ID,VIDEO_ID,EVENT_TYPE,EVENT_VALUE,TIMESTAMP
But to make it compatible with AWS Personalize, you should convert properties names to match Personalize requirements:
Users: USER_ID, USER_NAME, USER_LAST_LOGIN [...] etc.
Items: ITEM_ID, ITEM_CATEGORY, ITEM_VIEWS [...] etc.
Interactions: USER_ID,ITEM_ID,EVENT_TYPE,EVENT_VALUE,TIMESTAMP
As you can see, Interactions datasets has the information about:
Who (USER_ID) interacted with..
..what item (ITEM_ID)..
..at which time (TIMESTAMP).
Optionally you can add more information to this Interactions dataset, by providing EVENT_TYPE and EVENT_VALUE. So for example it would be like this:
Who (USER_ID) interacted with..
..what item (ITEM_ID)..
..at which time (TIMESTAMP)..
..what type of interaction it was (EVENT_TYPE)..
..what was the value of interaction (EVENT_VALUE).
In service that serves Video content, EVENT_TYPE could be for example video_view and EVENT_VALUE would be value between 0.0 and 1.0, which will show how much of the Video did User watched. For example, 0.5 would be 50% of the Video.
The EVENT_TYPE and EVENT_VALUE is optional, so you don't have to provide them, however it doesn't affect quality of recommendations. The EVENT_VALUE is only used for configuration of Personalize (more about that later).
Also there is one case, that you should remember about. If you provide only EVENT_TYPE or EVENT_VALUE, AWS Personalize will give you an error, because you need both of them, or none of them (which makes sense, since there is no point in storing event data that has unknown value or type).
EVENT_TYPE doesn't have to be only video_view. It can also have different values, for example if user is going to like the video, your application will save this interaction like this:
EVENT_TYPE = 'like'
EVENT_VALUE = 1
For dislike could be:
EVENT_TYPE = 'like'
EVENT_VALUE = -1
The use of event value
In general, Personalize doesn't include event value during training of the model. It's simply ignored.
However you can use it for implementing your own logic. For example, you can provide Event value threshold during the Solution creation:
This value threshold will be used to determine, if given interaction should be ignored, during Solution training. For example, if event value is percentage progress of watching a video, then having a threshold of 0.9 will make sure, than interactions included during the training, were about fully watching the video.
Also as you can see on the picture above, you can specify the event type itself, so the given solution will ignore all of the interactions, that doesn't match event type. It might be helpful in some cases.
Event type can be also used in Filters option, which was added a few months ago. It might be helpful to filter out the Items, that User already fully watched or bought, examples:
EXCLUDE itemId WHERE INTERACTIONS.event_type in ("fully_watched")
EXCLUDE itemId WHERE INTERACTIONS.event_type in ("purchased")

Reevoo API filtering

I am using Python to query the Reevoo API. As far as I can tell, the options for filtering are somewhat limited and the docs are an exhaustive list of what query parameters you can use. I was wondering if anybody had found a way to filter customer experience reviews with a date range?
Currently my hack solution is to use a generator which calls the API page by page and yields the review if its publish_date is after a certain date, which is obviously really inefficient. It doesn't help that the API returns the results slightly out of order, so I can't break/return as soon as I find one review that's out of range.
for i in range(number_of_pages, 0, -1):
# API call wrapper
page_of_reviews = self.reevoo.get_customer_experience_review_list(self.trkref, older_reviews=True,
page=i, per_page=30)
page_of_reviews = json.loads(page_of_reviews.text.replace('\r\n', ''))
customer_experience_reviews = page_of_reviews.get('customer_experience_reviews')
processed_reviews = self.process_customer_experience_reviews(customer_experience_reviews)
for item in processed_reviews['review_list']:
if from_dt:
if datetime.strptime(item['publish_date'], '%Y-%m-%d') >= datetime.strptime(from_dt, '%Y-%m-%d'):
yield item
else:
yield item
I've scoured the docs and Reevoo's GitHub page and haven't found anything, but in the hopes that some random person on the Internet has found a workaround... Does anyone have any ideas?
I emailed Reevoo to ask about date filtering and the short answer is that there is no way to filter or sort by date.
Explanation from the email:
Unfortunately, we cannot filter reviews by date as when we display the reviews, they are not necessarily in date order. For example, reviews with written content come before those which don't have written content as they have more value to the consumer. We would also prefer that you refreshed everything at least once a day, because older reviews sometimes have to be renewed or customers may sometimes request that there reviews be amended.
I understand why you would lie to do date filtering but at the moment, if you are caching reviews on your server, this is the way we prefer you to do it.

Difference between a post's likes count and the likes data?

I'm seeing a discrepancy between the number of likes reported in the Graph API vs the number of entries in the "data" that has the name and ID of the people who liked a post.
When I view a certain post on Facebook, I see that it has 5 people who have liked it.
When I use the Graph API to fetch the post, the "likes" field has a "data" field with 3 entries in it, and a "count" field whose value is 5.
When I use the Graph API to fetch the likes for the post (eg, {post_id}/likes), I get a "data" field with 5 entries in it (and no "count" field).
Clearly the true answer to how many people have liked the post is 5. But then why is there only 3 entries in the "data" when I fetch the post object?
Here's another example of the same discrepancy:
https://graph.facebook.com/40796308305_10150394134258306 returns data for a post whose "likes/data" only has 1 entry in it, but whose "likes/count" says that there are 3. But https://graph.facebook.com/40796308305_10150394134258306/likes returns "data" with 3 entries. Finding that same entry on Coca-Cola's page finds that there are, in fact, 3 people who have liked it.
The documentation of the post object doesn't mention that the likes list may be incomplete, and the documentation of the fql stream table explicitly says to use the post object to get the full list, so It's either a bug in the API or in the documentation.
I suspect it may be a deliberate but undesirable "feature" to limit the detailed list for performance reasons, as some posts may have hundreds or even thousands of likes.
It ends up actually causing a huge performance problem as I need to find all posts that have been liked by a particular user, and the only way to do that is to do a separate fetch of likes for each post in the list whose like count is higher than the like list length.
2 people have their privacy settings set to not show their name to people who are not their friends.

webservice for autosuggest on city names / postal codes including long-lat coordinates?

i'm looking for a webservice, to be used for an autocomplete field,
where people can fill in either a postal code / city name or both
this service will need all cities in Europe, so we can use it for all country websites.
and in a later stadium we want to keep the world open for asia and america so this would be a plus.
preferably it would also return the long-lat coordinates for the locations,
Now it is a free textfield, after leaving the field, we hit the google geocoding service,
to find coordinates... preferably i would tie these two together.
so we don't have to query 2 services for one thing.
does anyone know of the existance of such a service online somewhere?
or would you suggest to build our own database with cities / postal codes / coordinates?
if so we would need to get the content from somewhere too, and i was trying to avoid that issue :)
I recently searched for a similar service, in vain.
I wanted my users to have auto-complete on entering a city name, and once a city is chosen I needed to pass the name and lat/long onto the Google API. In the end I did this: -
downloaded the geonames allcountries.zip, full extract: this
Imported it into a SQL DB via SSIS (about 7.5 million records!)
Wrote a simple query to extract just the cities (only the PPLC, PPLA and PPLA2 records).
This left me with a manageable table of 9112 records (with lat / long and country code) which covers all the cities in the world. I then wrote my own code to query the data.
Not ideal, but I needed a solution.
I know this post is very old but for thouse who are looking for a simple solution that can be integrated in 5 minutes here is the link:
Geocomplete jQuery...
For my case I followed this steps:
1 - Download the plugin from here.
2 - Add the jquery.geocomplete.js or jquery.geocomplete.min.js file into your javascript folder of your project.
3 - Call this file in script tags on the html page where you have the input field that you have to autocomplete with cities:
<script src='/PathToTheFile/jquery.geocomplete.js'></script>
4 - To convert an input into an autocomplete field, simply call the Geocomplete plugin in script tags: <script>
$("#IdOfTheInputField").geocomplete(); // Option 1: Call on element.
$.fn.geocomplete("input"); // Option 2: Pass element as argument.
</script>
5- You can check for the complete list of options on the link provided at the top.
Hope that this helped!

Using Geo APIs to pick a random town from anywhere in the world

I'm trying to use Yahoo's excellent GeoPlanet API:
http://developer.yahoo.com/geo/geoplanet/guide/api-reference.html
I would like to pick a random town from anywhere in the world but can't see an easy way to do it. I have tried querying by country and asking for children of type 'town', but can't seem to do that directly.
Can anyone think of a way to pluck out a random town WOEID without having to query the country, then the admin regions, then the admin 2, then the admin 3 etc.
I have also experimented using YQL, but don't have enough of an understanding about the available APIs.
Have a look at http://world-gazetteer.com/.
You can store all towns in your local database, then do random select, and then just geocode selected town using any geocode service you like.
Just for phun, why not generate random lat/long & display whatever is there?