Blog Movver for Baidu,有些粗糙,见笑
时间:2008-03-08
来源:互联网
百度空间博客文章抓取Blog Movver for Baidu
有些粗糙,大家见笑
以后一定注意
[ 本帖最后由 sujun 于 2008-3-10 15:00 编辑 ]
Blog Mover for Baidu.rar (3.35 KB)
有些粗糙,大家见笑
复制PHP内容到剪贴板
<?
// Blog Mover for Baidu
// Verson : beta 1.0
// Date : 2008-3-6
// Copyright (C) 2008 Victor Su
// E-mail: [[email protected]][email protected][/email]
//
// This program is use to get the pepole's blog which on the site of [url=http://hi.baidu.com/]http://hi.baidu.com[/url] .
// With use it,you can catche as many of articles you want.
// This program is distributed in the hope that it will be useful.
//
function replace($old,$new,$string){
$string=str_replace($old,$new,$string);
return $string;
}
class Mover{
var $host_url="[url=http://hi.baidu.com/]http://hi.baidu.com[/url]";
var $path="/blog/index/";
var $who="sujun";
var $message;
var $num=0;
var $count=0;
var $index=3;
var $article;
var $time_begin=0;
var $time_end=0;
var $time_use=0;
var $Host = "127.0.0.1";
var $DB = "vs_blog";
var $User = "root";
var $Pwd = "123456";
var $table = "vs_blog";
function Mover(){
$conn=mysql_connect($this->Host,$this->User,$this->Pwd) or die("Êý¾Ý¿âÁ¬½Óʧ°Ü");
while(!(mysql_select_DB($this->DB,$conn))){
mysql_query("create database $this->DB");
}
$vs_sign=false;
$result=mysql_list_tables($this->DB,$conn);
while($row = mysql_fetch_row($result)){
if($row[0]==$this->table){
$vs_sign=true;
}
}
mysql_free_result($result);
if($vs_sign==false){
mysql_query("
CREATE TABLE $this->table (
`id` int(20) NOT NULL auto_increment,
`title` varchar(250) character set gbk NOT NULL,
`author` varchar(100) character set gbk NOT NULL,
`time` varchar(20) character set gbk NOT NULL,
`type` varchar(50) character set gbk NOT NULL,
`content` mediumtext character set gbk NOT NULL,
KEY `id` (`id`),
KEY `type` (`type`),
KEY `time` (`time`)
)
");
}
mysql_query("set names 'gbk'");
}
function run($who,$begin_page,$end_page){
set_time_limit(1000);
$this->time_begin=microtime (true);
for($n=$begin_page;$n<=$end_page;$n++){
$url=$this->host_url."/".$who.$this->path;
$url=$url.$n;
$this->catche($url,"\"",3,"<div class=\"tit\">","</div>");
}
$this->time_end = microtime (true);
……
多谢下面两位大哥给我提醒,马上注释;PHP代码:
<?
// Blog Mover for Baidu
// Verson : beta 1.0
// Date : 2008-3-6
// Copyright (C) 2008 Victor Su
// E-mail: [[email protected]][email protected][/email]
//
// This program is use to get the pepole's blog which on the site of [url=http://hi.baidu.com/]http://hi.baidu.com[/url] .
// With use it,you can catche as many of articles you want.
// This program is distributed in the hope that it will be useful.
//
function replace($old,$new,$string){
$string=str_replace($old,$new,$string);
return $string;
}
class Mover{
var $host_url="[url=http://hi.baidu.com/]http://hi.baidu.com[/url]";
var $path="/blog/index/";
var $who="sujun";
var $message;
var $num=0;
var $count=0;
var $index=3;
var $article;
var $time_begin=0;
var $time_end=0;
var $time_use=0;
var $Host = "127.0.0.1";
var $DB = "vs_blog";
var $User = "root";
var $Pwd = "123456";
var $table = "vs_blog";
function Mover(){
$conn=mysql_connect($this->Host,$this->User,$this->Pwd) or die("Êý¾Ý¿âÁ¬½Óʧ°Ü");
while(!(mysql_select_DB($this->DB,$conn))){
mysql_query("create database $this->DB");
}
$vs_sign=false;
$result=mysql_list_tables($this->DB,$conn);
while($row = mysql_fetch_row($result)){
if($row[0]==$this->table){
$vs_sign=true;
}
}
mysql_free_result($result);
if($vs_sign==false){
mysql_query("
CREATE TABLE $this->table (
`id` int(20) NOT NULL auto_increment,
`title` varchar(250) character set gbk NOT NULL,
`author` varchar(100) character set gbk NOT NULL,
`time` varchar(20) character set gbk NOT NULL,
`type` varchar(50) character set gbk NOT NULL,
`content` mediumtext character set gbk NOT NULL,
KEY `id` (`id`),
KEY `type` (`type`),
KEY `time` (`time`)
)
");
}
mysql_query("set names 'gbk'");
}
function run($who,$begin_page,$end_page){
set_time_limit(1000);
$this->time_begin=microtime (true);
for($n=$begin_page;$n<=$end_page;$n++){
$url=$this->host_url."/".$who.$this->path;
$url=$url.$n;
$this->catche($url,"\"",3,"<div class=\"tit\">","</div>");
}
$this->time_end = microtime (true);
……
以后一定注意
[ 本帖最后由 sujun 于 2008-3-10 15:00 编辑 ]

2008-3-10 15:00, 下载次数: 60
作者: sujun 发布时间: 2008-03-07
看不明白,希望能带点注释。
作者: chyoqin 发布时间: 2008-03-08
鼓励一下。


作者: luzhou 发布时间: 2008-03-08
引用:
原帖由 chyoqin 于 2008-3-8 09:46 发表看不明白,希望能带点注释。


作者: luzhou 发布时间: 2008-03-08
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28