Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         var itemList = {};
  2.  
  3.         const proxyurl = "https://cors-anywhere.herokuapp.com/";
  4.         const url = "https://csgoempire.gg/api/v2/p2p/inventory/cached"; // site that doesn’t send Access-Control-*
  5.         console.log(proxyurl + url);
  6.         fetch(proxyurl + url)
  7.         .then(response => response.json())
  8.         .then(contents => {
  9.             for (elt in contents) {
  10.                 if(!(contents[elt].hasOwnProperty('custom_price'))) {
  11.                     itemList[contents[elt].market_name] = contents[elt].market_value / 100;
  12.                 }
  13.             }
  14.  
  15.             console.log(itemList);
  16.         })
  17.         .catch(() => console.log("Can’t access " + url + " response. Blocked by browser?"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement