Is it possible to extract game's specific data using steam API? - json

I am new to Json and API.
But, for study now I am figuring out how to get specific game data from steam API.
I followed lots of process.. and get api code from steam.
At first, I thought that 'oh I can extract all of game data using my API code!'
but,,, there's a question.
Most of the JSON QUERY requires my API code.
But they print just single result (especially about certain ID)
I want to know about what game is best selling or played..
like the steamspy : http://steamspy.com/
But the steam API just offers only user stat and so on.
At this point, now I am highlight again. I am new to Json.
so.. I wonder, "Is it possible to extract game's specific data using steam API?"
Not the single user's data.
But the all of the game's list.
Thank you for reading.

I have done little research but I know you can colllect the game-names from Steam also the ID:s I
by using
http://api.steampowered.com/ISteamApps/GetAppList/v0001/
I believe then you can filtering with different criterias some stuff.
regarding the Steamspy
This may not answer the full question but why don't you just using Steamspys:s API
you can collect most played games:
http://steamspy.com/api.php
### genre ###
Returns games in this particular genre. Requires *genre* parameter and works like this:
* steamspy.com/api.php?request=genre&genre=Early+Access
### top100in2weeks ###
Returns Top 100 games by players in the last two weeks.
### top100forever ###
Returns Top 100 games by players since March 2009.
### top100owned ###
Returns Top 100 games by owners.
### all ###
Returns all games with owners data sorted by owners.
I hope this is to some help
Best regards
Xsi

Related

How to get top X number of items according to a property in a paginated API?

Please note the question is purposely vague.
Assume, I have an API that returns paginated data of books. 100 book objects per page [This data is present in the headers like 'total-pages'. The response body is in the format of a list of JSON objects.
[
{},
{},
.
.
.
]
Assume book object has all the necessary data such as title, description, number of sales, etc, and so on. How do I return top-selling n number of books [top-selling => Highest number of sales]?
You cannot provide any parameters such as
GET endpoint/orderby=popularity&order=desc
to this endpoint and you cannot make any database query optimizations. How do we solve this problem with just pure code?
I'll be grateful for any ideas or suggestions.
Since the endpoint is limited in the parameters it accepts, your only option is to fetch all the pages (by continuously looping until it errors) and then sort it in your program it self.
If the above solution is slow, you can optimize by relaxing your requirements from return top-selling n number of books to return a few top-selling books which are in the top X%

Getting all reviews from a steam game using Steamworks but always return the same page?

Currently, I am trying to get all the steam reviews from a particular game, using the method described in the Steamworks documentation: https://partner.steamgames.com/doc/store/getreviews
However, when I try to get reviews for a game like Dota 2 for example using the method:
http://store.steampowered.com/appreviews/570?json=1&start_offset=9200
http://store.steampowered.com/appreviews/570?json=1&start_offset=9220
I always got the same return after a small offset. There should be more than 878,134 reviews for Dota 2. Why I got the same return before reaching the end? Thanks.
Not all reviews can be accessed with the method described in https://partner.steamgames.com/doc/store/getreviews . For example, for now, there are 18 reviews in http://store.steampowered.com/app/794820/Knights_of_Pen_and_Paper_2_Free_Edition/. But there is nothing in http://store.steampowered.com/appreviews/794820?json=1.
You need to specify day_range. Try set day_range=9223372036854775807
source https://www.reddit.com/r/devsteam/comments/7qxjho/steam_api_user_reviews_query/

Getting all reviews from a steam game using Steamworks?

Currently, I am trying to get all the steam reviews from a particular game, using the method described in the Steamworks documentation:
https://partner.steamgames.com/doc/store/getreviews
However, when I try to get reviews for a game like Team Fortress 2 for example using the method:
http://store.steampowered.com/appreviews/440?json=1
I always get 20 reviews, due to the start_offset parameter.
Is there a way to get all the reviews in one method command, or do I have to create a loop with different start_offset?
Looks like Steam changed the API and now start_offset is not working, they changed it to cursor.
here is more info:
https://partner.steamgames.com/doc/store/getreviews
in simple words: you send eg.
http://store.steampowered.com/appreviews/10?json=1&cursor=*
and in return you get JSON with next cursor that you need to parse and use in next URL.
eg. "cursor": "AoIIPwYYanDTv+QB"
also you need to remember to encode cursor so next call would be like
http://store.steampowered.com/appreviews/10?json=1&cursor=AoIIPwYYanDTv%2BQB
Taplar mentioned it correctly in his comment. start_offset - reviews are returned in batches of 20, so pass 0 for the first set, then 20 for the next set, etc. You need to use the offset like this:
http://store.steampowered.com/appreviews/10?json=1&start_offset=0
http://store.steampowered.com/appreviews/10?json=1&start_offset=20
http://store.steampowered.com/appreviews/10?json=1&start_offset=40
For a game like DOTA 2 there are like 650,000+ reviews. If you imagine yourself in Valve's place it would make sense to limit API calls. So I think it's safe to say that there is no API for all reviews at once.

How to download IMF Data Through JSON in R

I recently took an interest in retrieving data in R through JSON. Specifically, I want to be able to access data through the IMF. I know virtually nothing about JSON so I will share what I [think I] know so far, and what I have accomplished.
I browsed their web page for JSON, which helped a little bit. It gave me the start point URL. Here is the web page; http://datahelp.imf.org/knowledgebase/articles/667681-using-json-restful-web-service
I managed to download (using the GET() and the fromJSON() functions) some lists, which are really bulky. I know enough about the lists that the "call" was successful, but I cannot for the life of me get actual data. So far, I have been trying to use the rawToChar() function on the "content" data but I am virtually stuck there.
If anything, I managed to create data frames that contain the codes, which I presume would be used somewhere in the JSON link. Here is what I have.
all.imf.data = fromJSON("http://dataservices.imf.org/REST/SDMX_JSON.svc/Dataflow/")
str(all.imf.data)
#all.imf.data$Structure$Dataflows$Dataflow$Name[[2]] #for the catalogue of sources
catalogue1 = cbind(all.imf.data$Structure$Dataflows$Dataflow$KeyFamilyRef,
all.imf.data$Structure$Dataflows$Dataflow$Name[[2]])
catalogue1 = catalogue1[,-2] # catalogue of all the countries
data.structure = fromJSON("http://dataservices.imf.org/REST/SDMX_JSON.svc/DataStructure/IFS")
info1 = data.frame(data.structure$Structure$Concepts$ConceptScheme$Concept[,c(1,4)])
View(data.structure$Structure$CodeLists$CodeList$Description)
str(data.structure$Structure$CodeLists$CodeList$Code)
#Units
units = data.structure$Structure$CodeLists$CodeList$Code[[1]]
#Countries
countries = data.frame(data.structure$Structure$CodeLists$CodeList$Code[[3]])
countries = countries[,-length(countries)]
#Series Codes
codes = data.frame(data.structure$Structure$CodeLists$CodeList$Code[[4]])
codes = codes[,-length(codes)]
# all.imf.data # JSON from the starting point, provided on the website
# catalogue1 # data frame of all the data bases, International Financial Statistics, Government Financial Statistics, etc.
# codes # codes for the specific data sets (GDP, Current Account, etc).
# countries # data frame of all the countries and their ISO codes
# data.structure # large list, with starting URL and endpoint "IFS". Ideally, I want to find some data set somewhere within this data base.
"info1" # looks like parameters for retrieving the data (for instance, dates, units, etc).
# units # data frame that indicates the options for units
I would just like some advice about how to go about retrieving any data, something as simple as GDP (PPP) for a constant year. I have been following an article in R blogs (which retrieved data in the EU's database) but I cannot replicate the procedure for the IMF. I feel like I am close to retrieving something useful but I cannot quite get there. Given that I have data frames that contain the names for the databases, the series and the codes for the series, I think it is just a matter of figuring out how to construct the appropriate URL for getting the data, but I could be wrong.
Provided in the data frame codes are the codes for the data sets I presume. Is there a way to make a call for the data for, let's say, the US for BK_DB_BP6_USD, which is "Balance of Payments, Capital Account, Total, Debit, etc"? How should I go about doing this in the context of R?

Scrape html Twitter followers using R

I have a continous task that I think can be automated using R.
Using the twitteR-package I have extracted a list of tweets. Those have been categorized into positive (and neutral) and negative tweets. This have been a manuel task - but I am looking into doing some machine learning on it.
My problem is the reach-part. I want to know not only the number of positive and negative tweets but also the number of people who potentialle have been exposed to the tweet.
There is a way to do this using the twitteR-package, but it is slow, as it requires the machine to sleep between each and every search. And with thousands of tweets this is not a proper way for me.
My thought was therefore if it is possible to extract the number of followers from the html-sourcecode of twitter using the html <- webpage <- getURL("http://www.twitter.com/AngelHaze") and here extract the number of followers.
Also, on top of this, I want to be able to do this using a vector of URL's ("http://www.twitter.com/AngelHaze") and then combining them into a dataframe with the ScreenName (AngelHaze) and the number of followers. I am from Denmark, so the sourcecode containing the number of followers look like this
a class="ProfileNav-stat ProfileNav-stat--link u-borderUserColor u-textCenter js-tooltip js-nav u-textUserColor" title="196.262 følgere" data-nav="followers"
href="/AngelHaze/followers""
Where "196.262 følgere" is the relevant part.
Is this possible? And if yes, can anyone help me going?
Best, Sander Ehmsen.