本次创作简单暴力,代码从多处整合,了解增加访问数的机制后,均可以使用此方法来增加阅读数访问量,简单来说,就是刷用户访问量,总归来说刷访问量是不对的,不应该提倡,了解这种思路即可。代码如下
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
public class aaa {
public static String str="taskkill /F /IM chrome.exe";
//指定打开网页的浏览器,后面这些参数就是网址,
public static String str1="cmd /c start chrome "
+ "https://blog.csdn.net/java_xdo/article/details/84136678 "
+ "https://blog.csdn.net/java_xdo/article/details/80745277 "
+ "https://blog.csdn.net/java_xdo/article/details/79487978 "
+ "https://blog.csdn.net/java_xdo/article/details/77776386 "
+ "https://blog.csdn.net/java_xdo/article/details/78944855 "
+ "https://blog.csdn.net/java_xdo/article/details/77414750 ";
//我这里把要访问的网址分成了两部分,浏览器不敢一次打开得太多,怕爆炸
public static String str2="cmd /c start chrome "
+ "https://blog.csdn.net/java_xdo/article/details/87875682 "
+ "https://blog.csdn.net/java_xdo/article/details/87875203 "
+ "https://blog.csdn.net/java_xdo/article/details/87711217 "
+ "https://blog.csdn.net/java_xdo/article/details/87712362 "
+ "https://blog.csdn.net/java_xdo/article/details/80745277 "
+ "https://blog.csdn.net/java_xdo/article/details/86589917 ";
public static ArrayList strList=new ArrayList();
public aaa(){
strList.add(str1);
strList.add(str2);
}
public static void main(String args[]) {
// defaultBrowserOpenUrl();
aaa openUrl=new aaa();
int num = 0;
//设定时间格式,定义开始时间结束时间
String state,end;
SimpleDateFormat adf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
while(true){
int i = 0;
String strUrl = "";
while (i < 2) {
strUrl = strList.get(i);
state=adf.format(new Date());
System.out.println("开始时间:"+state);
System.out.println("访问的url:"+strUrl);
num+=1;
openFirefoxBrowser(strUrl, str);
System.out.println("打开次数:"+num+"增加人数:"+num*6);
//每关闭一次浏览器,等待大概30s再重启
try {
Thread.sleep(30000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
i++;
}
//遍历一次睡30秒
try {
Thread.sleep(30000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
end=adf.format(new Date());
System.out.println("结束时间=================="+end);
}
}
//使用指定的浏览器打开
public static void openFirefoxBrowser(String start,String stop) {
// 启用cmd运行谷歌的方式来打开网址。
try {
Runtime.getRuntime().exec(start);
try {
Thread.sleep(60000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Runtime.getRuntime().exec(stop);
} catch (IOException e) {
e.printStackTrace();
}
}
}