Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var rp = require("request-promise");
  2. var fs = require("fs-extra");
  3.  
  4. var item = { //Paar daten als beispiel. "data" hält am Ende alle neuen infos
  5.     name: "AK-47 | Redline (Field-Tested)",
  6.     shortName: "AK-47 | Redline (FT)",
  7.     inspect: "steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20M2096895882184785298A15699827149D12557388178881307451",
  8.     data: {}
  9. }
  10.  
  11. function apiCall(inUri){
  12.     const options = {
  13.         uri: inUri,
  14.         headers: {
  15.             'User-Agent': 'Request-Promise'
  16.         },
  17.         json: true
  18.     };
  19.     return rp(options)
  20. }
  21.  
  22. async function getAllInfo(item) {
  23.    
  24.     const sales = await apiCall("https://skins.w1z0.xyz/?t=cfab5cccbc94e3e8&name=" + item.name);
  25.     const wear = await apiCall("https://api.csgofloat.com/?url=" + item.inspect);
  26.     const overpay = await apiCall("http://188.166.72.201:8000/check?item=" + item.shortName);
  27.  
  28.     Promise.all([sales, wear, overpay]).then(results => {
  29.         item.data.sales = results[0];
  30.         item.data.wear = results[1];
  31.         item.data.overpay = results[2];
  32.         fs.outputJSON('item.json',item).then( () => {
  33.             console.log(" >>> Saved");
  34.         })
  35.     })
  36. }
  37.  
  38.  
  39.  
  40.  
  41. getAllInfo(item);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement