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 

API calls with JSON formatted results for public/pm output

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


Joined: 10 Feb 2009
Posts: 140

PostPosted: Tue Jan 29, 2013 1:28 pm    Post subject: API calls with JSON formatted results for public/pm output Reply with quote

I am looking for a script that creates API requests based on public user input.

The API requests return JSON formatted data from a webserver, which needs to be formatted to a pre-defined format and displayed in channel or pm (depending on the initial request).
Back to top
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 310
Location: Constanta, Romania

PostPosted: Tue Jan 29, 2013 2:35 pm    Post subject: Reply with quote

If you can be more specific... examples/commands it would help whoever looks at this post alot including me
_________________
https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
x0x
Op


Joined: 10 Feb 2009
Posts: 140

PostPosted: Tue Jan 29, 2013 2:37 pm    Post subject: Reply with quote

For users, the program will work like this.

user: !triggera <title>
bot: <most recent result from database>

user: !triggerb <title>
bot: pm: <10 most recent results from database>

The results contain information like title, date, size, category etc.
Back to top
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 310
Location: Constanta, Romania

PostPosted: Tue Jan 29, 2013 2:39 pm    Post subject: Reply with quote

And from where will the data's be retrieved? The best way to get the data's from is an XML/RSS page
_________________
https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
x0x
Op


Joined: 10 Feb 2009
Posts: 140

PostPosted: Tue Jan 29, 2013 2:40 pm    Post subject: Reply with quote

The only way is with a get request to a php page on https. It will return JSON formatted results.

-edit: I've received an API key
Back to top
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 310
Location: Constanta, Romania

PostPosted: Tue Jan 29, 2013 2:44 pm    Post subject: Reply with quote

Well i need to see the page from where do you want the results to be get from so trigger that page using that API key and copy paste here the source of that page ot see how it looks like and maybe using regexp we will be able to retrive what you want from it
_________________
https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
x0x
Op


Joined: 10 Feb 2009
Posts: 140

PostPosted: Tue Jan 29, 2013 4:40 pm    Post subject: Reply with quote

curl "https://site.com/req.php?release=title%&key=123456789"

[["TITLE.1","CAT-A",1350000000,"20","274","Comedy_Drama",0,""],["TITLE.2","CAT-B",1340000000,"19","906.0","Drama",0,""],["TITLE.3","CAT-C",1330000000,"6","246.00","Thriller",0,""]]

Like that. So a title, category, unix time, files, size, genre etc.

-edit-

And that needs to look like this in channel for the 1 result trigger:

bot: [title.1] [cat-a] [time] etc.

^ This is the first result from the get request.


The trigger for more results should PM all of the results from the get request and say in channel it's sending a pm.
Back to top
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 310
Location: Constanta, Romania

PostPosted: Tue Jan 29, 2013 4:56 pm    Post subject: Reply with quote

Yes for someone that is good at regexp it shouldnt be that hard Smile yet im not good at. But now everyone else that looks to this topic will know what you ask for and maybe they will help you... they now have the souce for the page so its only a regexp apart...
_________________
https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
x0x
Op


Joined: 10 Feb 2009
Posts: 140

PostPosted: Tue Jan 29, 2013 5:26 pm    Post subject: Reply with quote

I'm really no scripter, but I guess this is some kind of start based on stuff I discovered.

Code:
package require http
package require json

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


I hope someone is able and willing to help me out.
Back to top
View user's profile Send private message
x0x
Op


Joined: 10 Feb 2009
Posts: 140

PostPosted: Wed Jan 30, 2013 6:20 am    Post subject: Reply with quote

Is it against the rules if I mention I am willing to paypal 20usd (or euro for that matter) as a gift for a working script?
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Wed Jan 30, 2013 3:52 pm    Post subject: Reply with quote

Offering (or for that part, asking for) payment is not against the forum rules, to my best knowledge. Such arrangements would however be solely between the developer and the customer; if you get huzzled, don't blame egghelp.org or us moderators..

That said, given that your previous thread got junked for violating forum rules, this one is getting borderline going there as well...
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
x0x
Op


Joined: 10 Feb 2009
Posts: 140

PostPosted: Thu Jan 31, 2013 10:14 am    Post subject: Reply with quote

I fully understand and respect that.

Meanwhile someone has responded to my request. We've got the script running for about 75% and he/she received my promised donation. In this case, everyone is happy Smile
Back to top
View user's profile Send private message
Qrx
Voice


Joined: 09 Jan 2014
Posts: 1

PostPosted: Fri Jan 10, 2014 8:18 am    Post subject: Reply with quote

I have the same problem. I have been trying to work out how to handle requests/answers regarding a JSON website.

I tried contacting the OP, but he/she is not willing to share the code.

Is there anyone else that is able to give me a hint in the right direction?

What I need:

Request data from a JSON module and put the reply in usable strings so I can make the bot spit them out. The rest of the code I can figure out myself.

Thanks in advance!
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