April 27, 2022

[v0.0.4] Скрипт отслеживания новых NFT на letmespeak.org - LMS_tracker

Telegram @letcryptowalk

В v0.0.4 добавлено:

  • Для безопасности (блокировка ip сервером) установил время запроса новых страниц в рандомном диапазоне от 20 до 30сек;
  • Оптимизировал нагрузку на браузер - сократил общее кол-во отображаемых NFT на странице до 165, более старые автоматически удаляются;
  • Упростил вывод карточек - добавил имя и убрал картинки;

Инструкция:

  1. Открой страницу https://market.letmespeak.org/
  2. Открой dev tools (Ctrl+Shift+J (on Windows - chrome) or Ctrl+Option+J (on Mac))
  3. Выбери вкладку Console, вставь туда код и нажми Enter
let lastItemsList=[];document.querySelector(".ant-row-stretch ").innerHTML='<div class="cards-wrap"></div>';const urls=["https://api-crypto.letmespeak.org/api/escrow?sortBy=LowestPrice&page=1&rarity=2","https://api-crypto.letmespeak.org/api/escrow?sortBy=LowestPrice&page=2&rarity=2"];function sendFetch(){let e=[];fetch(urls[0]).then(t=>t.json()).then(t=>{e.push(t.items),e=e.reduce((t,e)=>t.concat(e)),function(t){let r=[];t.forEach(t=>{let e,a="",i=t.nft.details.attributes;e=!lastItemsList.includes(t.id),r.push(t.id),i.forEach(t=>{if(["name","visa_total","talent","invites_left"].includes(t.trait_type))switch(t.trait_type){case"name":a+=' <div class="ant-col item-attr" style="color:rgb(0, 0, 0);"> <span>Name:</span> <div class="Attribute_value__ENcJL Attribute_compact__eY5_v">'+t.value+"</div> </div> ";break;case"visa_total":a+=' <div class="ant-col item-attr" style="color:rgb(255, 122, 0);"> <span>Visa:</span> <div class="Attribute_value__ENcJL Attribute_compact__eY5_v">'+i[8].value+"/"+t.value+"</div> </div> ";break;case"talent":a+=' <div class="ant-col item-attr"> <span>Talent:</span> <div class="Attribute_value__ENcJL Attribute_compact__eY5_v">'+t.value+"</div> </div> ";break;case"invites_left":a+=' <div class="ant-col item-attr"> <span>Invites:</span> <div class="Attribute_value__ENcJL Attribute_compact__eY5_v">'+t.value+"</div> </div> "}});t=' <style> .UICard_root__AlKWx {flex-direction: row;} .NFTListItem_avatar__3UTOV {max-width: 80px;} .ant-col-md-8 {flex: 0 0 100%; max-width: unset;} .ant-col-xs-12 {flex: 0 0 33% !important; max-width: unset; } .ant-col-lg-18 { flex: 0 0 100%; max-width: unset; } .ant-col.ant-col-xs-24.ant-col-lg-6{display:none} .UICard_root__AlKWx{padding: 0;} .item-attr { text-align: center; } .card-item {padding:5px;} .ant-row.ant-row-stretch>.ant-col>*{justify-content: center !important;} </style> <a href="https://market.letmespeak.org/#/escrow/'+t.id+'" class="card-item ant-col ant-col-xs-12 ant-col-md-8" style="padding-left: 8px; padding-right: 8px; '+(e?"background: rgba(143, 255, 143, .6);":"")+'"> <div class="UICard_root__AlKWx NFTListItem_root__3JXf3 pointer" style="align-items: stretch; justify-content: flex-start;"> <div class="mt05"> <div class="ant-row ant-row-center" style="row-gap: 4px;"> '+a+' <div class="ant-col"> <div class="ml025" style="color:rgb(39, 117, 202);"> <span>price</span> <div class="Attribute_value__ENcJL Attribute_compact__eY5_v">'+t.price+"</div> </div> </div> </div> </div> </div> </a> ";document.querySelector(".ant-row-stretch").insertAdjacentHTML("afterbegin",t)}),document.querySelector(".ant-row-stretch").insertAdjacentHTML("afterbegin",'<div class="card-time-download" style="width:100%">'+(new Date).toUTCString()+"</div>"),lastItemsList=r,r=[]}(e)})}let counterForTimer=0,timerFetchItems=setTimeout(function t(){var e=1e4*Math.random()+2e4;if(10<counterForTimer){document.querySelectorAll(".card-item").forEach((t,e)=>{165<e&&t.remove()});let t=document.querySelectorAll(".card-time-download");t[t.length-1].remove()}counterForTimer+=1,sendFetch(),timerFetchItems=setTimeout(t,e)},0);

Следить за обновлениями скрипта можно на канале https://t.me/letcryptoWalk