已阅读5页,还剩1页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
百度贴吧内容抓取工具让你的网站一夜之间内容丰富hide百度帖吧内容抓取工具?php class import var $url=; var $maxpagecount=1000; var $maxtimeout=60; var $timeout=30; var $pagecount=0; var $beginpage=0; var $curpage=0; var $endpage=0; var $begincon=; var $pagecon=; var $title=; var $getimg=1; var $getcon=1; var $getauthor=1; var $getreplytime=1; var $showimg=1; var $showcon=1; var $showauthor=1; var $showreplytime=1; var $showsn=0; var $showhr=0; var $replylista=array(); var $pat_reply=(.+?)rn; var $pat_pagecount=尾页; var $pat_title=(.+?); var $pat_replycon=rnrn(.+?)rn; var $pat_author=作者: (?:|)(.+?)(?:|) rn; var $pat_img=; var $pat_replytime= (0-91,4-0-91,2-0-91,2 0-91,2:0-91,2)+ ; var $defaulturl=/f?kz=87576027; function import() $this-setconfig(); if(isset($_POSTact) $this-getconfig(); $this-showform(); $this-act(); else $this-showform(); function setconfig() $this-url=isset($_POSTurl)?$_POSTurlthis-defaulturl; $this-url=eregi_replace(&?pn=(0-9+),$this-url); $this-beginpage=isset($_POSTbeginpage)?$_POSTbeginpage:0; $this-endpage=isset($_POSTendpage)?$_POSTendpage:50; $this-endpage=min($this-maxpagecount,$this-endpage); $this-timeout=min(isset($_POSTtimeout)?$_POSTtimeout:30,$this-maxtimeout); $this-showimg=isset($_POSTshowimg)?$_POSTshowimg:1; $this-showcon=isset($_POSTshowcon)?$_POSTshowcon:1; $this-showauthor=isset($_POSTshowauthor)?$_POSTshowauthor:0; $this-showreplytime=isset($_POSTshowreplytime)?$_POSTshowreplytime:0; $this-showhr=isset($_POSTshowhr)?$_POSTshowhr:1; $this-showsn=isset($_POSTshowsn)?$_POSTshowsn:0; $this-getimg=isset($_POSTgetimg)?$_POSTgetimg:1; $this-getcon=isset($_POSTgetcon)?$_POSTgetcon:1; $this-getauthor=isset($_POSTgetauthor)?$_POSTgetauthor:0; $this-getreplytime=isset($_POSTgetreplytime)?$_POSTgetreplytime:0; set_time_limit($this-timeout); function act() $this-getpagelist(); $this-showreplylist(); function getconfig() $this-pagecon=$this-getcon($this-url.&pn=0); $this-getpagecount(); $this-gettitle(); $this-beginpage=min(max(0,$this-beginpage),$this-pagecount); $this-endpage=min($this-maxpagecount,max(0,min($this-endpage,$this-pagecount); function gettitle() $this-title=$this-match($this-pat_title,$this-pagecon); function getcon($url) if($f=fopen($url,r) $con=; while($line=fgets($f) $con.=$line; fclose($f); else return false; return $con; function getpagelist() for($i=$this-beginpage;$iendpage;$i=$i+50) if($i0)$this-pagecon=$this-getcon($this-url.&pn=$i); $this-getreplylista(); function getreplylista() if(preg_match_all(/.$this-pat_reply./sim,$this-pagecon,$a) foreach($a0 as $key=$reply) $this-curpage=$a1$key; if($this-curpage=$this-beginpage&$this-curpageendpage) $replya=array(); $replyasn=$a1$key; if($this-getimg|$this-showimg) $tmp=$this-match($this-pat_img,$reply); if($tmp!=)$replyaimg=$tmp; if($this-getcon|$this-showcon) $tmp=$this-match($this-pat_replycon,$reply); if($tmp!=)$replyacon=$tmp; if($this-getauthor|$this-showauthor) $tmp=trim($this-match($this-pat_author,$reply); if($tmp!=)$replyaauthor=$tmp; if($this-getreplytime|$this-showreplytime) $tmp=$this-match($this-pat_replytime,$reply); if($tmp!=)$replyareplytime=$tmp; $this-replylista$this-curpage=$replya; if($this-curpage$this-endpage)break; function match($pat,$con,$n=1,$default=) if(preg_match(/.$pat./sim,$con,$a) return $a$n; else return $default; function getpagecount() $this-pagecount=$this-match($this-pat_pagecount,$this-pagecon,2,0); if($this-pagecount=0)$this-pagecount=50; function clearpop() function showreplylist() echo 以下为抓取内容:; echo .$this-title.; foreach($this-replylista as $replya) if($this-showhr)echo ; if($this-showsn&isset($replyasn)echo $replyasn.:; if($this-showimg&isset($replyaimg)echo ; if($this-showcon&isset($replyacon)echo $replyacon.; if($this-showauthor&isset($replyaauthor)echo $replyaauthor.; flush(); function showform() ? 百度帖吧内容抓取工具: 网址: input name=url type=text id=url value=url? size=100 你要取抓取的帖子主题网址如: a href=url? target=_blankurl? 起始记录: input name=beginpage type=text id=beginpage value=beginpage? 终止记录: input name=endpage type=text id=endpage value=endpage? 超时设置: input name=timeout type=text id=timeout value=timeout? 提取项目: input name=getcon type=checkbox id=getcon value=1 getcon)echo checked;? 内容 input name=getimg type=checkbox id=getimg value=1 getimg)echo checked;? 图片 input name=getauthor type=checkbox id=getauthor value=1 getauthor)echo checked;? 作者 input name=getreplytime type=checkbox id=getreplytime value=1 getreplytime)echo checked;? 回复时间 预览项目: input name=showcon type=checkbox id=showcon value=1 showcon)echo checked;? 内容 input name=showimg type=checkbox id=showimg value=1 showimg)echo checked;? 图片 input name=showauthor type=checkbox id=showauthor value=1 showauthor)echo checked;? 作者 input na
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 留校意向协议书范本
- 自闭症儿童训练康复治疗
- 冠心病常见症状及护理心脏按摩
- 直播服务费协议合同
- 租地授权委托协议书
- 矿山土地复垦协议书
- 租房改装合同协议书
- 租用写字楼合同范本
- 租用舞蹈教室协议书
- 乙肝常见症状及护理技术
- 2025山西临汾安泽县人力资源和社会保障局开发招用公益性岗位40人备考题库附答案解析
- 英威腾变频器培训课件
- 职业技能鉴定初级通信终端设备维修工考核试题
- 2025DAS指南:成人未预料困难气管插管的管理解读课件
- 户内燃气抢修培训课件
- 企业报税实操课件
- 克拉玛依介绍
- 2025至2030中医医院行业项目调研及市场前景预测评估报告
- 2026年高考作文备考之议论文主体段落写作指导:“五层结构法”详解
- 2025年学法考试广东考场一试题及答案本
- 雨课堂在线学堂《全球化与世界空间》单元考核测试答案
评论
0/150
提交评论