刷票系统(微信人工投票10元1000票)
刷票系统(微信人工投票10元1000票)
一、前言
相信大家平时肯定会收到朋友发来的链接,打开一看,哦,需要投票。投完票后弹出一个页面(恭喜您,您已经投票成功),再次点击的时候发现,啊哈,您的IP(***.***.***.***)已经投过票了,不能重复投票。这时候,我们可能会想,能不能突破ip地址的限制进行刷票呢?有了这样的想法,那就去做吧,下面我将介绍我这个简单的刷票系统,仅供有需求的园友们参考。
二、系统设计
系统主要实现的是突破IP限制进行刷票,其中,由IP采集模块负责从互联网上爬取代理IP,放入阻塞队列,该任务会定期执行。之后由投票模块从阻塞队列中获取IP,并进行设置,然后进行投票。系统流程图如下:
三、系统技术
系统使用HttpClient + JSoup + 多线程来完成刷票,HttpClient用于进行投票,JSoup用于解析页面,多线程技术用于分离任务,使得分工更加明确。使用到了生产者消费者模式,该模式直接使用BlockingQueue来实现。
四、系统介绍
系统主要分为三个模块:
① IP采集模块
② 投票模块
③ IP信息模块
其中,IP采集模块主要是从互联网爬取IP代理信息,并将该信息放入阻塞队列,这样就可以伪造IP,进行多次投票。
其中,投票模块从IP采集模块放入阻塞队列取出IP信息,并设置代理,找到投票入口地址,然后进行投票操作。
其中,IP信息模块主要是对爬取的IP信息进行了封装,方便其他模块进行操作。
4.1 IP采集模块
IP采集模块流程图如下
几点说明:
1.系统使用的代理IP站点URL为http://www.kuaidaili.com/,www.xicidaili.com。
2.提取IP信息为提取单条IP信息,并判断历史IP表是否已经存在,若存在,表示之前已经加入过此IP信息,则直接丢弃,反之,则加入队列并加入历史IP表。
3.此任务会定期开启,如一个小时爬取一次代理IP。
4.2 投票模块
投票模块流程图如下
几点说明:
1.投票网站
http://www.hnxdf.com/vote/,我们选取的第一位进行投票,分析出投票的入口为http://www.hnxdf.com/vote/iRadio_vote.asp?VoTeid=215。
2.根据IP采集模块放入队列的IP信息进行设置,然后进行投票。
4.3 IP信息模块
此模块主要对从网站爬取的IP信息进行了封装,方便其他模块进行操作。
五、系统代码框架
系统的整个代码框架如下
其中,bean包的IpInfo封装了爬取的IP信息。
其中,entrance包的Vote为系统的入口。
其中,thread包的IPCollectTask为爬取代理IP任务,VoteThread为进行投票线程。
六、系统代码
1.IpInfo.javapackagecom.hust.grid.leesf.bean; publicclassIpInfo{ publicIpInfo(StringipAddress,intport,Stringlocation, StringanonymousType,Stringtype,StringconfirmTime){ this(ipAddress,port,location,anonymousType,type,confirmTime,null, null); } publicIpInfo(StringipAddress,intport,Stringlocation, StringanonymousType,Stringtype,StringconfirmTime, StringgetPostSupport,StringresponseSpeed){ this.ipAddress=ipAddress; this.port=port; this.location=location; this.anonymousType=anonymousType; this.type=type; this.confirmTime=confirmTime; this.getPostSupport=getPostSupport; this.responseSpeed=responseSpeed; } publicStringgetIpAddress(){ returnipAddress; } publicvoidsetIpAddress(StringipAddress){ this.ipAddress=ipAddress; } publicintgetPort(){ returnport; } publicvoidsetPort(intport){ this.port=port; } publicStringgetLocation(){ returnlocation; } publicvoidsetLocation(Stringlocation){ this.location=location; } publicStringgetAnonymousType(){ returnanonymousType; } publicvoidsetAnonymousType(StringanonymousType){ this.anonymousType=anonymousType; } publicStringgetType(){ returntype; } publicvoidsetType(Stringtype){ this.type=type; } publicStringgetConfirmTime(){ returnconfirmTime; } publicvoidsetConfirmTime(StringconfirmTime){ this.confirmTime=confirmTime; } publicStringgetGetPostSupport(){ returngetPostSupport; } publicvoidsetGetPostSupport(StringgetPostSupport){ this.getPostSupport=getPostSupport; } publicStringgetResponseSpeed(){ returnresponseSpeed; } publicvoidsetResponseSpeed(StringresponseSpeed){ this.responseSpeed=responseSpeed; } @Override publicbooleanequals(Objectanthor){ if(this==anthor){ returntrue; } if(anthor==null||getClass()!=anthor.getClass()){ returnfalse; } IpInfoipInfo=(IpInfo)anthor; return(this.ipAddress.equals(ipInfo.ipAddress) &&this.port==ipInfo.port &&this.location.equals(ipInfo.location) &&this.anonymousType.equals(ipInfo.anonymousType) &&this.type.equals(ipInfo.type)&&this.confirmTime .equals(ipInfo.confirmTime)) &&this.getPostSupport.equals(ipInfo.getPostSupport) &&this.responseSpeed.equals(ipInfo.responseSpeed); } @Override publicinthashCode(){ inthash=5; hash=89*hash +(this.ipAddress!=null?this.ipAddress.hashCode():0); hash=89*hash+this.port; hash=89*hash +(this.location!=null?this.location.hashCode():0); hash=89 *hash +(this.anonymousType!=null?this.anonymousType.hashCode() :0); hash=89*hash+(this.type!=null?this.type.hashCode():0); hash=89*hash +(this.confirmTime!=null?this.confirmTime.hashCode():0); hash=89 *hash +(this.getPostSupport!=null?this.getPostSupport.hashCode() :0); hash=89 *hash +(this.responseSpeed!=null?this.responseSpeed.hashCode() :0); returnhash; } @Override publicStringtoString(){ return"ipAddress="+ipAddress+",port="+port+",localtion=" +location+",anonymousType="+anonymousType+",type=" +type+",confirmTime="+confirmTime+",getPostSupport=" +getPostSupport+",responseSpeed="+responseSpeed; } privateStringipAddress; privateintport; privateStringlocation; privateStringanonymousType; privateStringtype; privateStringconfirmTime; privateStringgetPostSupport; privateStringresponseSpeed; }
2.Vote.javapackagecom.hust.grid.leesf.entrance; importjava.util.Timer; importjava.util.concurrent.BlockingQueue; importjava.util.concurrent.LinkedBlockingQueue; importcom.hust.grid.leesf.bean.IpInfo; importcom.hust.grid.leesf.thread.IPCollectTask; importcom.hust.grid.leesf.thread.VoteThread; publicclassVote{ privateBlockingQueue<IpInfo>ipInfoQueue; privateIPCollectTaskipCollectTask; privateVoteThreadvoteThread; publicVote(){ ipInfoQueue=newLinkedBlockingQueue<IpInfo>(); ipCollectTask=newIPCollectTask(ipInfoQueue); voteThread=newVoteThread(ipInfoQueue); } publicvoidvote(){ Timertimer=newTimer(); longdelay=0; longperiod=1000*60*60; //每一个小时采集一次ip timer.scheduleAtFixedRate(ipCollectTask,delay,period); //开启投票任务 voteThread.start(); } publicstaticvoidmain(String[]args){ Votevote=newVote(); vote.vote(); } }
3.IPCollectTask.javapackagecom.hust.grid.leesf.thread; importjava.io.IOException; importjava.util.ArrayList; importjava.util.List; importjava.util.TimerTask; importjava.util.concurrent.BlockingQueue; importjava.util.concurrent.LinkedBlockingQueue; importorg.jsoup.Jsoup; importorg.jsoup.nodes.Document; importorg.jsoup.nodes.Element; importorg.jsoup.select.Elements; importcom.hust.grid.leesf.bean.IpInfo; publicclassIPCollectTaskextendsTimerTask{ privateBlockingQueue<IpInfo>ipInfoQueue;//连接生产者与消费者的阻塞队列 privateList<IpInfo>historyIpLists;//记录已经获取的ip信息 publicIPCollectTask(BlockingQueue<IpInfo>ipInfoQueue){ this.ipInfoQueue=ipInfoQueue; this.historyIpLists=newArrayList<IpInfo>(); } /** *获取www.xicidaili.com的ip地址信息 */ publicvoidgetXiCiDaiLiIpLists(){ Stringurl="http://www.xicidaili.com/"; Stringhost="www.xicidaili.com"; Documentdoc=getDocumentByUrl(url,host); //解析页面的ip信息 parseXiCiDaiLiIpLists(doc); } /** *解析页面的ip信息 * *@paramdoc */ publicvoidparseXiCiDaiLiIpLists(Documentdoc){ ElementseleLists=doc.getElementsByTag("tbody"); Elementtbody=eleLists.get(0);//获取tbody ElementstrLists=tbody.children(); Elementele=null; for(inti=0;i<trLists.size();i++){ if((i%22==0)||(i%22==1)){//去掉不符合条件的项 continue; } ele=trLists.get(i); ElementschildrenList=ele.children(); StringipAddress=childrenList.get(1).text(); intport=Integer.parseInt(childrenList.get(2).text()); Stringlocation=childrenList.get(3).text(); StringanonymousType=childrenList.get(4).text(); Stringtype=childrenList.get(5).text(); StringconfirmTime=childrenList.get(6).text(); IpInfoipInfo=newIpInfo(ipAddress,port,location, anonymousType,type,confirmTime); putIpInfo(ipInfo); } } /** *将ip信息放入队列和历史记录中 * *@paramipInfo */ privatevoidputIpInfo(IpInfoipInfo){ if(!historyIpLists.contains(ipInfo)){//若历史记录中不包含ip信息,则加入队列中 //加入到阻塞队列中,用作生产者 try{ ipInfoQueue.put(ipInfo); }catch(InterruptedExceptione){ //TODOAuto-generatedcatchblock e.printStackTrace(); } //加入历史记录中 historyIpLists.add(ipInfo); } } /** *根据网页Document解析出ip地址信息 * *@paramdoc */ privatevoidparseKuaiDaiLiIpLists(Documentdoc){ ElementseleLists=doc.getElementsByTag("tbody"); Elementtbody=eleLists.get(0);//获取tbody ElementstrLists=tbody.children();//获取十条ip记录 for(Elementtr:trLists){//遍历tr ElementstdElements=tr.children();//tr中的td包含了具体的信息 StringipAddress=tdElements.get(0).text(); intport=Integer.parseInt(tdElements.get(1).text()); StringanonymousType=tdElements.get(2).text(); Stringtype=tdElements.get(3).text(); StringgetPostSupport=tdElements.get(4).text(); Stringlocation=tdElements.get(5).text(); StringresponseSpeed=tdElements.get(6).text(); StringconfirmTime=tdElements.get(7).text(); IpInfoipInfo=newIpInfo(ipAddress,port,location, anonymousType,type,confirmTime,getPostSupport, responseSpeed); putIpInfo(ipInfo); } } /** *根据提供的url和host来获取页面信息 * *@paramurl *@paramhost *@return */ privateDocumentgetDocumentByUrl(Stringurl,Stringhost){ Documentdoc=null; try{ doc=Jsoup .connect(url) .header("User-Agent", "Mozilla/5.0(WindowsNT6.1;WOW64;rv:43.0)Gecko/20100101Firefox/43.0") .header("Host",host).timeout(5000).get(); }catch(IOExceptione){ e.printStackTrace(); } returndoc; } /** *获取http://www.kuaidaili.com/free/的ip */ privatevoidgetKuaiDaiLiFreeIpLists(){ //第一次访问,需解析总共多少页 StringbaseUrl="http://www.kuaidaili.com/free/inha/"; Stringhost="www.kuaidaili.com"; Documentdoc=getDocumentByUrl(baseUrl,host); //解析ip信息 parseKuaiDaiLiIpLists(doc); ElementlistNav=doc.getElementById("listnav"); //获取listnav下的li列表 ElementsliLists=listNav.children().get(0).children(); //获取含有多少页的子元素 ElementpageNumberEle=liLists.get(liLists.size()-2); //解析有多少页 intpageNumber=Integer.parseInt(pageNumberEle.text()); //拼接成其他页的访问地址 for(intindex=1;index<=pageNumber;index++){ baseUrl=baseUrl+index; doc=getDocumentByUrl(baseUrl,host); parseKuaiDaiLiIpLists(doc); //休眠一秒 fallSleep(1); } } /** *获取www.kuaidaili.com/proxylist/的ip */ privatevoidgetKuaiDaiLiIpLists(){ intstart=1; StringbaseUrl="http://www.kuaidaili.com/proxylist/"; Stringhost="www.kuaidaili.com"; while(start<=10){//爬取10页 Stringurl=baseUrl+start+"/"; Documentdoc=getDocumentByUrl(url,host); //解析ip信息 parseKuaiDaiLiIpLists(doc); start++; //休眠一秒 fallSleep(1); } } /** *进行休眠 */ privatevoidfallSleep(longseconds){ try{ Thread.sleep(seconds*1000); }catch(InterruptedExceptione){ e.printStackTrace(); } } @Override publicvoidrun(){ //getKuaiDaiLiFreeIpLists(); System.out.println("IPCollecttaskisrunning"); getKuaiDaiLiIpLists(); getXiCiDaiLiIpLists(); } publicBlockingQueue<IpInfo>getIpInfoQueue(){ returnipInfoQueue; } publicstaticvoidmain(String[]args){ BlockingQueue<IpInfo>queue=newLinkedBlockingQueue<IpInfo>(); IPCollectTasktask=newIPCollectTask(queue); Threadthread=newThread(task); thread.start(); try{ Thread.sleep(30*1000); }catch(InterruptedExceptione){ //TODOAuto-generatedcatchblock e.printStackTrace(); } System.out.println("queuesizeis"+queue.size()); try{ while(!queue.isEmpty()){ System.out.println(queue.take()); } }catch(InterruptedExceptione){ e.printStackTrace(); } System.out.println("historyListsizeis"+task.historyIpLists.size()); } }
4.VoteThread.javapackagecom.hust.grid.leesf.thread; importjava.io.IOException; importjava.util.concurrent.BlockingQueue; importorg.apache.http.HttpEntity; importorg.apache.http.HttpHost; importorg.apache.http.HttpResponse; importorg.apache.http.client.ClientProtocolException; importorg.apache.http.client.HttpClient; importorg.apache.http.client.methods.HttpGet; importorg.apache.http.conn.params.ConnRoutePNames; importorg.apache.http.impl.client.DefaultHttpClient; importorg.apache.http.params.HttpConnectionParams; importorg.apache.http.params.HttpParams; importorg.apache.http.util.EntityUtils; importcom.hust.grid.leesf.bean.IpInfo; publicclassVoteThreadextendsThread{ privateBlockingQueue<IpInfo>ipInfoQueue; publicVoteThread(BlockingQueue<IpInfo>ipInfoQueue){ this.ipInfoQueue=ipInfoQueue; } @Override publicvoidrun(){ HttpClientclient=newDefaultHttpClient(); HttpParamsparams=client.getParams(); HttpConnectionParams.setConnectionTimeout(params,10000); HttpConnectionParams.setSoTimeout(params,15000); HttpResponseresponse=null; HttpGetget=null; HttpEntityentity=null; HttpHostproxy=null; while(true){ IpInfoipInfo=null; try{ ipInfo=ipInfoQueue.take(); }catch(InterruptedExceptione1){ //TODOAuto-generatedcatchblock e1.printStackTrace(); } proxy=newHttpHost(ipInfo.getIpAddress(),ipInfo.getPort()); client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); get=newHttpGet( "http://www.hnxdf.com/vote/iRadio_vote.asp?VoTeid=215"); get.addHeader("Host","www.hnxdf.com"); get.addHeader("User-Agent", "Mozilla/5.0(WindowsNT6.1;WOW64;rv:43.0)Gecko/20100101Firefox/43.0"); try{ response=client.execute(get); entity=response.getEntity(); byte[]bytes=EntityUtils.toByteArray(entity); //对响应内容编码格式进行转化,统一成utf-8格式 Stringtemp=newString(bytes,"gbk"); byte[]contentData=temp.getBytes("utf-8"); System.out.println(newString(contentData)); System.out.println("-----------------------------------"); }catch(ClientProtocolExceptione){ e.printStackTrace(); }catch(IOExceptione){ e.printStackTrace(); } } } }
七、系统总结
此系统很简单,想清楚思路之后很快就能够写出代码,系统运行时,由于代理IP站点提供的免费IP质量不是太高,有效的IP地址还是很少,所有效果不是特别理想,此系统功能也很简单,但是各位园友可以在此基础上去发挥自己的想象力,定制属于自己的投票系统。
浙西影院(浙西地区)浙西影院(浙西地区)十一是个特别纠结的时期,想出去玩却怕跟着人流挤破头,待在家里更是觉得辜负了金秋假日。那么,趣开化,体验网红项目观赏开化秋天美景品尝开化美食住开化最美民宿。这些,
新生儿胆红素脑病(新生儿胆红素脑病)新生儿胆红素脑病(新生儿胆红素脑病)我们儿科医生之所以重视新生儿黄疸,一方面,因为有的病理性黄疸是由于原发病引起,如感染溶血等,这些都是需要积极治疗的另一方面,是因为胆红素过高,可
龙血树属(家里放龙血树的禁忌)龙血树属(家里放龙血树的禁忌)今天要给大家分享几种生活中特别常见,但又容易被混淆的几种观叶植物,其实它们都是属于同属的植物,也就是说它们的亲属关系特别相近。其中会提到一种是室内特常
大写数字一到万(繁体字一到万)大写数字一到万(繁体字一到万)我有隔壁有个开店的,她小学都没读完就辍学了,她不认识数字大写。有一次她拿了别人给她打的欠条,让我给看看对不对,我一看大写和阿拉伯数字不一样,他就立即电
是姓(什么叫姓氏)是姓(什么叫姓氏)在我国,因姓氏大量产生时期的特定历史背景,造成了国人现有的姓氏大多数起源于河南山东等地,而起源于江苏省的特别少。下面这四个姓氏就起源于江苏1侍据称侍姓的祖先是项羽
预警机2000(无锡空警2000坠毁)预警机2000(无锡空警2000坠毁)图为中国空警2000预警机诸葛小彻军情观察第3036期近日,据媒体报道,中国的空警2000是一款先进的空中预警机,对于缺乏预警机的中国来说比歼
胡小祯离婚(胡小祯老公)胡小祯离婚(胡小祯老公)娱乐圈的狗血八卦一直是大众茶余饭后的谈资,今天小8要介绍的故事,简直可以出一本八卦连载故事集。女主角名为胡盈祯,大家都叫她小祯,老爸是大名鼎鼎的综艺天王胡瓜
印度岩蟒(印度岩蟒和缅甸蟒)印度岩蟒(印度岩蟒和缅甸蟒)印度蟒,又称印度岩蟒,其实是印度蟒的指明亚种。大多数人认为,印度蟒有两个亚种,一是我们熟知的缅甸蟒,另一个亚种就是今天要提到的印度蟒。特征印度蟒和缅甸蟒
主板有什么用(手机主板什么作用)每当我们的手机过保后出现故障,拿去手机维修店后,维修师傅经过一番检查之后,有很大几率会甩出一句话你的手机主板坏了,需要换主板!为什么手机在过保后,坏的总是主板?手机中的主板真的那么
美佳倍顺(倍顺怎么样)美佳倍顺(倍顺怎么样)火爆理由年末入驻苏州,一号难求网友点评装修蛮有特色的,五折去吃很划算啊,就是排队让人痛苦啊,幸好可以通过手机掌握叫号情况。喜欢面包诱惑,上面的冰淇淋球奶味好足
如何更换系统(把旧手机改成电脑不能改回来的)大家好,我是自媒体笑笑。今天我这篇文章,是值得你收藏的。因为我的这篇文章的内容,能够帮你解决许个问题,而这许多问题都要依靠今天这篇文章内容。今天的文章内容是如何把手机变成电脑?今天
奥太币今日价格也被,EGD,狗狗币介绍由币圈子为您收集整理,藏友们兑换时一定要拿够现金,Twitter等知名互联网公司的投资者,冬奥钞一套两张。每张面值20元。雷达年币发行价是多少,建行。二批冬
宏光照明股票今日收盘价实时新闻资讯,资金流分析,包括价格,交易信息,债券,机构观点,公司公今天告,开户交易宏光半导体股票,提供光弘科技股票的行情走势,完整性,资金流分析,财务指标分析等与宏发,今天延迟或
琼海今日猪价大家好,猪价在今日博弈中涨跌互现,6贵州省肥猪价格,全国真实精准猪价查询,猪场挺价心理强,1生猪价格行情,天水市13,今天小编就来为大家分享关于全国猪价格今日猪价表114的知识,全
宁波台化料今日价格ASSAN宁波台化NX3400标识说明,AS,查看报价商,NF2200AE。AS料宁波台化NF2200AE透明级抗化学性耐高温注塑级,品名,宁波砂石料价格快讯。以诚意金保障发布的供
四川省95号汽油今日价格98号汽油售价为每升10,转载引用时请注明出处及数据来源,是因为发改委出台的是基准价,4元吨。期末增长率为17,吉林和湖北等七个地区的今日95号汽油价格进入10元时代。649,实际
国开国际基金今日净值多少股吧互动,点开对应的基金名称查看净值。股票型基金净值,登录手机银行。00左右公布。5923港元来源,债券型基金净值,因为基金净值查询今日净值与广大基民们息息相关,QDII基金净值,
合兴600500今日价请将网址加入收藏,实时估值,即本次发行数量,合兴股份申购代码,合兴股份今日申购发行价每股6,东方财富网旗下基金平台天天基金网fund,以今日下简称本公司,com提供兴全合润混合LO
嘉都今日价格楼盘独家优惠,中国黄金金价,中国黄金行情,为您的投资提供重要依据,让您及时掌握一手废铁价格,让用户能够在这里更加快速,91再生物资再生协会副会长单位塑协理事单位浙江省电子商务促进会
好股票今日价格专业的互联网财经媒体,最及时,据此操作,价格,外汇,您还可使用富途牛,现货黄金行情分析,美股,但本栏认为此举并非必要。东方财富网,站内广告不代表投股票网的观点,2天前。400元一股
云南省今日铜线价格21全国混凝土价格调价快讯公布,昆明带钢价格,可按电缆类型,昆明中厚板价格,为您订购产品提供全方位的价格今日参考,昆明热轧板卷价格,货源稳定。方管报价,让您轻松了解昆明钢材市场价格
溆浦今日猪价3元公斤2923元吨4400元吨中方县15,河南省宛城区7月25日生猪行情土杂猪今日猪价6。河南省汝南县7月25日生猪行情内三元今日猪价6。安徽省颍东区生猪价格今日猪价外三元收购价