tele2 api lots page as text
当前为
// ==UserScript==
// @name tele2 api lots text view
// @namespace http://tampermonkey.net/
// @version 0.1
// @description tele2 api lots page as text
// @author
// @match https://tele2.ru/api/exchange/lots?*
// @icon https://www.google.com/s2/favicons?sz=64&domain=tele2.ru
// @grant none
// ==/UserScript==
(function() {
'use strict';
if (document.querySelector("body > pre")) {
let obj = JSON.parse(document.body.firstElementChild.innerText);
if (obj.data.length > 0) {
let newIT = obj.data[0].volume.value + obj.data[0].volume.uom + ' ' + obj.data[0].cost.amount + '\n\n';
if (obj.data.length > 5) obj.data[5].id = '\n' + obj.data[5].id;
for (let key of obj.data) {
newIT += key.id + '\t' + (key.my?'t2bot ':'') + key.seller.name + ' ' + key.seller.emojis + '\n';
};
document.body.firstElementChild.innerText = newIT;
} else document.body.firstElementChild.innerText = 'no lots';
};
})();