Last active
February 15, 2022 08:22
-
-
Save Dafrok/9f379a42aea8d5616cc141678c3f6e0e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ~function () { | |
| var flag = true | |
| var interval | |
| function refresh() { | |
| if (flag) { | |
| console.log((new Date).toLocaleString()) | |
| var iframe = document.createElement('iframe') | |
| iframe.src = 'https://shop103422196.taobao.com/category.htm?spm=a1z10.3-c.w4002-6402908702.30.83cQDQ&_ksTS=1465271481288_143&callback=jsonp144&mid=w-6402908702-0&wid=6402908702&path=%2Fcategory.htm&orderType=newOn_desc' | |
| document.body.appendChild(iframe) | |
| iframe.onload = function () { | |
| setTimeout(function () { | |
| if (flag) { | |
| var links = iframe.contentDocument.querySelectorAll('.item-name') | |
| var innerFlag = true | |
| for (let i = 0; i < links.length; i++) { | |
| var link = links[i] | |
| var text = link.innerText | |
| if (~text.toLowerCase().indexOf('连衣裙') && ~text.toLowerCase().indexOf('misty')) { | |
| if (flag) { | |
| innerFlag = false | |
| console.log('Get!') | |
| clearInterval(interval) | |
| link.click() | |
| } | |
| } | |
| } | |
| flag = innerFlag | |
| document.body.removeChild(iframe) | |
| iframe = null | |
| } | |
| }, 1000) | |
| } | |
| } | |
| } | |
| interval = setInterval(refresh, 1000) | |
| }() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fetch('https://shop103422196.taobao.com/i/asynSearch.htm?_ksTS=1465277136700_158&callback=jsonp159&mid=w-12440288900-0&wid=12440288900&path=/category.htm&spm=a1z10.3-c.w4002-6402908702.30.83cQDQ&orderType=newOn_desc') | |
| .then(res => res.text()) | |
| .then(data => { | |
| let text = data.toString() | |
| console.log(text.match) | |
| let m = text.match('/^<([a-z]+)\s*\/?>.*(?:<\/\1>)?$/i').match(/<a.*<\/a>/g) | |
| if (m) { | |
| for (let i = 1; i < m.length; i++) { | |
| if (m[i].indexOf('Ete')) { | |
| console.log('done') | |
| } | |
| } | |
| } | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment