egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Marvel API

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
spithash
Master


Joined: 12 Jul 2007
Posts: 248
Location: Libera

PostPosted: Wed Feb 12, 2014 3:46 am    Post subject: Marvel API Reply with quote

Hello there!

Some friends requested a script that could fetch info from http://developer.marvel.com/docs and I thought I should give it a try and see if someone's offering to help me around.

To get info from that API you need an account and an API key (which both are easy to get on their website, took me 2 minutes to get everything straight)

So... after I generated the API key I was able to search for "Spider-Man" for example and got a bunch of information from the first section "
/v1/public/characters" such as:

Code:
        "id": 1009610,
        "name": "Spider-Man",
        "description": "Bitten by a radioactive spider, high school student Peter Parker gained the speed, strength and powers of a spider. Adopting the name Spider-Man, Peter hoped to start a career using his new abilities. Taught that with great power comes great responsibility, Spidey has vowed to use his powers to help people.",
        "modified": "2013-10-24T13:52:13-0400",
        "thumbnail": {
          "path": "http://i.annihil.us/u/prod/marvel/i/mg/3/50/526548a343e4b",



So I was hoping if someone could help me scrap all that information and post it in the channel for example by character searching !marvel Spider-Man

I sure hope I explained everything needed Razz
Thanks.
_________________
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Wed Feb 12, 2014 7:09 am    Post subject: Reply with quote

The results you are looking at are in JSON format. Here's an example of such a request.
Code:

package require http
package require json

set query [::http::formatQuery name $name key 123456789]
set http  [::http::geturl https://site.com/api/ -query $query]
set json  [::http::data $http]
set data  [::json::json2dict json]

and then use dict to get stuff you want from $data variable.
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber