发布时间:2025-12-09 13:47:19 浏览次数:4
#### 前言:
相信很多写博客的朋友,会苦恼于博客访问量上不去的问题。博主最近工作比较新手动谢了个小程序,一个可以刷访问量的程序。当然主要是针对csdn博客。有了他 就再也不必担心博客访问量上不去的问题了。
####
一,废话少说,看图:
软件 点击jar 包直接运行:如下:
稍后查看博客访问量会有变化哟,博主只是进行可简单测试,如果你一直刷,那么你的博客访问量就会蹭蹭的上涨哟:
####
二,代码介绍:
代码其实没什么东西,很好理解。csdn默认使用一台电脑刷新文章,访问量默认是不会发生变化的。于是我们只能用代理ip 来访问博客了。博主在网上找了一些代理ip。当然如果失效。你可以更新ip地址。
献上地址:GitHub:https://github.com/zqHero/FreeIpAgent/blob/master/Ips.txt
下面主要是博主在网上收集到的ip代理:
1,首先我们应该获取到我们的IP代理地址:
/** * 获取 ip 代理地址: * @param url * @return */public static List<IPAgentEntity> getIp(String url) { List<IPAgentEntity> ipList = new ArrayList<IPAgentEntity>(); try { //1.向ip代理地址发起get请求,拿到代理的ip Document doc = Jsoup.connect(url) .userAgent("Mozilla") .cookie("auth", "token") .timeout(3000) .get(); //匹配正则表达式: Pattern pattern = Pattern.compile("\\d+\\.\\d+\\.\\d+\\.\\d+:(\\d)*"); Matcher matcher = pattern.matcher(doc.toString()); ArrayList<String> ips = new ArrayList<String>(); while (matcher.find()) { ips.add(matcher.group()); }for( String ip : ips) {IPAgentEntity myIp = new IPAgentEntity();String[] temp = ip.split(":");myIp.setAddress(temp[0].trim());myIp.setPort(temp[1].trim());ipList.add(myIp);} } catch (IOException e) { if(mcallback != null)mcallback.requesCallBack("加载错误:" + e.toString() + "\r\n加载 代理ip地址出错:\r\n" + "请移步:https://github.com/zqHero/FreeIpAgent/blob/master/Ips.txt 检查是否更改"); } return ipList; }2,其次使用我们的ip设置 我们请求属性,访问博客:
////1.想http代理地址api发起请求,获得想要的代理ip地址static List<IPAgentEntity> ipList = getIp(Constants.IPAgentUrl);private static void reques() {// TODO Auto-generated method stubif (murls == null || murls.size()==0) {return;}for(String url :murls){if (url == null || url.equals("")) {continue;}int count = 0;//默认 每条 文章地址请求 10000 次:for(int i=0; i< 10000; i++){IPAgentEntity myIpAgentEntity = ipList.get((int) (Math.random() * ipList.size()));System.setProperty("http.maxRedirects", "50"); System.getProperties().setProperty("proxySet", "true"); System.getProperties().setProperty("http.proxyHost", myIpAgentEntity.getAddress()); System.getProperties().setProperty("http.proxyPort", myIpAgentEntity.getPort()); try {Document doc = Jsoup.connect(url) .userAgent("Mozilla") .cookie("auth", "token") .timeout(3000) .get();if(doc != null) {count++;if(mcallback != null)mcallback.requesCallBack(url + "--成功刷新次数: " + count);}} catch (IOException e) {if(mcallback != null)mcallback.requesCallBack(myIpAgentEntity.getAddress() + ":" + myIpAgentEntity.getPort() + "报错");}}}}这样我们就完成了CSDN博客的流量的刷新工作。简书的博主试过,貌似没用,不过简书的默认刷新浏览器就可以增加访问量了。
献上源码地址:
https://github.com/zqHero/FreeIpAgent
####注:文中Ip为作者在网上随便找的代理IP地址。如若无用,请读者自行更换代理ip尝试。
各位老铁如果不行,自己尝试去修改一下源码,,,注意代理ip是否有效。。