| View previous topic :: View next topic |
| Author |
Message |
x0x Op
Joined: 10 Feb 2009 Posts: 140
|
Posted: Tue Jan 29, 2013 1:28 pm Post subject: API calls with JSON formatted results for public/pm output |
|
|
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 |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Tue Jan 29, 2013 2:35 pm Post subject: |
|
|
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 |
|
 |
x0x Op
Joined: 10 Feb 2009 Posts: 140
|
Posted: Tue Jan 29, 2013 2:37 pm Post subject: |
|
|
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 |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Tue Jan 29, 2013 2:39 pm Post subject: |
|
|
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 |
|
 |
x0x Op
Joined: 10 Feb 2009 Posts: 140
|
Posted: Tue Jan 29, 2013 2:40 pm Post subject: |
|
|
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 |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Tue Jan 29, 2013 2:44 pm Post subject: |
|
|
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 |
|
 |
x0x Op
Joined: 10 Feb 2009 Posts: 140
|
Posted: Tue Jan 29, 2013 4:40 pm Post subject: |
|
|
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 |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Tue Jan 29, 2013 4:56 pm Post subject: |
|
|
Yes for someone that is good at regexp it shouldnt be that hard 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 |
|
 |
x0x Op
Joined: 10 Feb 2009 Posts: 140
|
Posted: Tue Jan 29, 2013 5:26 pm Post subject: |
|
|
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 |
|
 |
x0x Op
Joined: 10 Feb 2009 Posts: 140
|
Posted: Wed Jan 30, 2013 6:20 am Post subject: |
|
|
| 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 |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Wed Jan 30, 2013 3:52 pm Post subject: |
|
|
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 |
|
 |
x0x Op
Joined: 10 Feb 2009 Posts: 140
|
Posted: Thu Jan 31, 2013 10:14 am Post subject: |
|
|
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  |
|
| Back to top |
|
 |
Qrx Voice
Joined: 09 Jan 2014 Posts: 1
|
Posted: Fri Jan 10, 2014 8:18 am Post subject: |
|
|
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 |
|
 |
|