【发布时间】:2014-01-01 03:27:55
【问题描述】:
我需要一个扫描网站以查找链接的程序。这是我到目前为止所拥有的,但它不会自动单击或查找链接,它只是刷新页面。你们能否修复代码中的错误或告诉我如何修复它们?顺便说一句,此代码用于刷新 nike 的 twitter 提要的机器人,然后在链接出现后立即自动点击链接。 “var shoeName”是鞋子的名称。谢谢
var shoeName = "Nike Flyknit Max";
var nikestore = "nikestore";
var closeFlag = "no";
var tFunction = "twitterScan()";
var tweet = new Array();
var tweetName = new Array();
function twitterScan() {
for (var i = 0; i < 4; i++) {
tweetName[i] = document.getElementsByClassName("fullname js-action-profile-name show-popup-with-id")[0].innerHTML;
tweet[i] = document.getElementsByClassName("js-tweet-text")[i].innerHTML;
}
//if (document.getElementsByClassName("fullname js-action-profile-name show-popup-with-id")[0].innerHTML;
if (tweet[0].match(shoeName) == shoeName) {
document.getElementsByClassName("twitter-timeline-link")[0].click();
tFunction = "get outa here";
shoeName = " 4444 4 456 7 8 456 7 345 7 345 345 3 1 1 133s "; //buffer to jump out of interval loop
}
else if (tweet[1].match(shoeName) == shoeName) {
document.getElementsByClassName("twitter-timeline-link")[1].click();
tFunction = "get outa here";
shoeName = " 4444 4 456 7 8 456 7 345 7 345 345 3 1 1 133s "; //buffer to jump out of interval loop
}
else if (tweet[2].match(shoeName) == shoeName) {
document.getElementsByClassName("twitter-timeline-link")[2].click();
tFunction = "get outa here";
shoeName = " 4444 4 456 7 8 456 7 345 7 345 345 3 1 1 133s "; //buffer to jump out of interval loop
}
else if (tweet[3].match(shoeName) == shoeName) {
document.getElementsByClassName("twitter-timeline-link")[3].click();
tFunction = "get outa here";
shoeName = " 4444 4 456 7 8 456 7 345 7 345 345 3 1 1 133s "; //buffer to jump out of interval loop
}
else {
location.reload(true);
}
setTimeout(tFunction, 250);
}
setTimeout(tFunction, 250);
//setInterval("refreshPage()", 3000);
//setTimeout("twitterScan()", 100);
//setInterval(tFunction, 700);
【问题讨论】:
-
您是否尝试将此代码应用到属于其他人的网页,而不编写这是他们的源代码?我不确定这是否可能。
标签: javascript html search hyperlink