jimgreer
704 posts
|
We’ve got a new feed that will be useful for people making things like the Kongregate Firefox Sidebar and Metaward. It’s actually two different kinds of feeds – one of all badges available, and one showing the badges any individual user has.
Andrew did them as JSON, which is a simpler and more compact format than XML. There are JSON parsing libraries for most popular languages, including AS2 & AS3.
Try it out – these might not look right in your browser, but you can download them as a file and open in notepad or whatever.
http://www.kongregate.com/badges.json
This feed returns the following info:
- Badge description
- Title and URL of the game(s) the badge is on
- Badge name
- URL of badge icon
- Badge difficulty / points earned
- How many users have earned it
- When it was created
- Unique id
http://www.kongregate.com/accounts/jimgreer/badges.json
This one returns the badges earned by the given user – it’s just a list of badge ids and the date earned.
You can also have these call a javascript function directly (sometimes useful if you’re doing an AJAX web app):
http://www.kongregate.com/accounts/andrew/badges.json?callback=foo
|
|
|
UnknownGuardian
6182 posts
|
Thanks! Didn’t see this till now. Great. I’d love to make an app. Is there anyway to get the name of an individual through the use of a method that requires only prompting once? (for mass distibuting, so you can just make one app)
|
|
|
jimgreer
704 posts
|
Um, you could ask the user to input their username. Am I missing something?
|
|
|
dasmitimsad
1762 posts
|
The sites do not work for me. :/
|
|
|
UnknownGuardian
6182 posts
|
Originally posted by jimgreer:
Um, you could ask the user to input their username. Am I missing something?
Well, I don’t want to distribute an app that each time you need to type in your username, nor do I want to make 500 different apps for the different users that might want a personalized app.
|
|
|
jonathanasdf
3835 posts
|
uhh, that’s why you store it on the user’s computer/browser profile
|
|
|
UnknownGuardian
6182 posts
|
Originally posted by jonathanasdf:
uhh, that’s why you store it on the user’s computer/browser profile
But when you distribute the flash player app won’t its directory change as it might be uploaded to multiple different websites?
|
|
|
jonathanasdf
3835 posts
|
Oh so you want to use a flash player app …
Then of course they will need to log in every time if they access it from a different computer/browser…. otherwise there’s a lot of room for security issues. Of course, they can still look at the list of all the badges (thus knowing when new ones come out) without logging in.
For sites like facebook if you put on a specialized version you can probably pull the username stuff from the facebook API and thus use it that way (i’m not sure). Of course, if you’re using FP10 you can always use ExternalInterface to access the browser (through javascript), and store the data that way. It can then be pulled across all the different versions of your app. However, whether that info is stored for a single session or forever is up to you, depending on whether it’d be violating any security policies if it’s stored forever…
|
|
|
paralaxx
59 posts
|
The API is now being used for updating kong users on metaward. Yay!
Thank you very much for building it. It should save us both a ton of bandwidth and headaches.
How about a full dump of user’s badges, and a daily dump of changes in badges, so I don’t have to recrawl? ;)
Anyways, thanks again.
|
|
|
hero122
6075 posts
|
This post has been removed by an administrator or moderator
|
|
|
skyboy
5915 posts
|
would be interesting if you were to duplicate this for the games page (http://www.kongregate.com/games) which i expect the json file already exists, since http://www.kongregate.com/games.js and http://www.kongregate.com/games are the same exact page but http://www.kongregate.com/games.json returns a supposed 404 (you do this on other pages that do in fact exist (obvious from your calls to the pages from the holodeck and returning a value, to the ajax script), but the client doesn’t have proper permissions)
|
|
|
UnknownGuardian
6182 posts
|
Well there is 2 options then. You could do they incorrect thing and “hack” to get that. Or you could say please and you might receive it. I advise the second only and will personally ignore anyone who ever decides to hack.
|
|
|
skyboy
5915 posts
|
unknown, some things you can’t “hack,” not in the sense you mean anyway. there is no outside way to get to the badges.json; it’s all internal. other thing (your muted users, /accounts/#{user}/muted_users.json, however, is locked, but not blocked)
|
|
|
MostAwesomeDude
5 posts
|
Cool. I ported the script I use to generate my profile stats, to this API. It’s nice.
$ ./kong.py jimgreer
Acquiring badges.json… OK!
Acquiring jimgreer.json… OK!
Acquiring jimgreer’s badges.json… OK!
- copy below this line -
November 19, 2009
- Acquired Badges: 228 of 851 (26.79% complete)
- Impossibles: 0 of 37 (0.00% complete)
- Average Points per Badge: 11.45
- Average Badges per Day: 0.20
- Estimated date of completion: June 21, 2018
- end of stats -
EDIT: http://github.com/MostAwesomeDude/madsnippets/blob/master/kong.py if you like. ~ C.
|
|
|
UnknownGuardian
6182 posts
|
Feed is now at api.kongregate.com for those who want to integrate it. That site has a non-restrictive crossdomain.xml.
|
|
|
jonathanasdf
3835 posts
|
UG, why did you not announce your new app in this thread?
|
|
|
UnknownGuardian
6182 posts
|
Originally posted by jonathanasdf:
UG, why did you not announce your new app in this thread?
Because my goal was not to show it off. :P
|
|
|
skyboy
5915 posts
|
since the badge IDs are not zero indexed, and some badges have been removed. could index 0 be, instead of badge #1, the number of badges removed? or could the spaces that used to have badges be filled with an empty object/null?
|
|
|
UnknownGuardian
6182 posts
|
Originally posted by skyboy:
since the badge IDs are not zero indexed, and some badges have been removed. could index 0 be, instead of badge #1, the number of badges removed? or could the spaces that used to have badges be filled with an empty object/null?
Why do you need them to go from 0 to X with no blanks? Its a json feed. You could just parse them in the order you get them, which is numerically.
|
|
|
Seanproductions
111 posts
|
Thank you for posting this!
|
|
|
skyboy
5915 posts
|
Originally posted by UnknownGuardian:
Originally posted by skyboy:
since the badge IDs are not zero indexed, and some badges have been removed. could index 0 be, instead of badge #1, the number of badges removed? or could the spaces that used to have badges be filled with an empty object/null?
Why do you need them to go from 0 to X with no blanks? Its a json feed. You could just parse them in the order you get them, which is numerically.
badges[userBadges[x].id - 1].icon_url is not accurate, because of the blank spaces, so i had to hack around it using a while loop, currently maxed at 100; if i had the number of badges removed, i could make sure the app will work no matter how many badges are removed; or if the ones that were removed are left as nulls in the array, then the indexes are more properly aligned
|
|
|
johnsolo97
17 posts
|
|
|
|
GameBuilder15
7830 posts
|
Originally posted by johnsolo97:
PPROGRAMMING SUCKS…..
Actually it’s fun xD
|
|
|
resterman
510 posts
|
JSON file with mobile badges… Someone?
|
|
|
UnknownGuardian
6182 posts
|
Originally posted by resterman:
JSON file with mobile badges… Someone?
Looked around for one and didn’t see it a while back.
|