Advertisement
Guest User

Json-Nodejs

a guest
Aug 28th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 1.24 KB | None | 0 0
  1. Kód:
  2. unirest.get("https://ugamb.ga/api.php").header("Accept", "application/json").end(function(response) {
  3. var body = response.body;
  4.  
  5. stats = JSON.parse(body);
  6.   stats = stats[0]
  7. ch.sendMessage(
  8.     "Nev: " + stats.Nev + "\n" +
  9.     "Osszeg: " + stats.Osszeg + "\n");
  10. });
  11.  
  12. Weboldal:
  13. [ { "Nev": 32142, "Osszeg": 222 } ]
  14.  
  15. Kérdés: a stats-ot honnan nyeri ki?
  16.  
  17. eredeti lekérés:
  18. [{"STATUS":1,"ID":32142,"Name":"Miguel Grau","Level":24,"XP":4773,"Strength":2847,"Energy":500,"MilitaryRank":50,"CS":"Peru","LastSeen":231,"Banned":"No","DMG1HIT":10385}]
  19.  
  20. https://www.erevollution.com/en/api/citizen/32142
  21.  
  22. eredeti kód:
  23. //Usage: +erevprofile [profileNumber]
  24. var profileNumber = message.suffix;
  25.  
  26. unirest.get("https://www.erevollution.com/en/api/citizen/" + profileNumber).header("Accept", "application/json").end(function(response) {
  27. var body = response.body;
  28.  
  29. stats = JSON.parse(body);
  30.   stats = stats[0]
  31. ch.sendMessage(
  32.     "Name: " + stats.Name + "\n" +
  33.     "Level: " + stats.Level + "\n" +
  34.     "Rank: " + stats.MilitaryRank + "\n" +
  35.     "Energy: " + stats.Energy + "\n" +
  36.     "Strength: " + stats.Strength + "\n" + "Country of Citizenship: " + stats.CS + "\n" + "Profile Link: https://www.erevollution.com/en/citizen/" + profileNumber);
  37. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement