Advertisement
Guest User

Untitled

a guest
Mar 10th, 2017
702
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function pad(v, size) {
  2.   if (v == undefined) return "00";
  3.   var s = String(v);
  4.   while (s.length < (size || 2)) {s = "0" + s;}
  5.   return s;
  6. }
  7.  
  8. function P(keyword, serverCode) {
  9.   if (!serverCode) serverCode = "KYPROSA";
  10.   if (!keyword) return 0;
  11.   var resp = JSON.parse(UrlFetchApp.fetch("https://project-arche.appspot.com/api/auctions/" + serverCode + "/" + keyword).getContentText());
  12.   if (resp.length == 0) return 0;
  13.   var price = resp[0].SinglePrice;
  14.   return pad(price.Gold, 0) + "." + pad(price.Silver) + pad(price.Bronze);
  15. }
  16.  
  17. function refresh() {
  18.   SpreadsheetApp.getActiveSpreadsheet().getRange('C1').setValue(new Date().toTimeString());
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement