原创文章自动采集(优采云梦dedecms添加自动生成代码来实现,先普及下织梦采集器)

优采云 发布时间: 2021-10-02 06:17

  原创文章自动采集(优采云梦dedecms添加自动生成代码来实现,先普及下织梦采集器)

  织梦使用优采云采集器采集数据,发布文档后不会自动生成第一页、下一章和专栏页。我们可以将自动生成代码添加到织梦Dedecms。首先,普及"K12","K5","K0"的知识:

  优采云是一款可以大量使用的软件采集原创文章

  优采云采集器有什么好处

  1、强大的通用性

  无论是新闻、论坛、视频、黄页、图片还是下载网站,只要你能通过浏览器看到结构化内容并指定匹配规则,你就可以采集获得你需要的内容

  2、稳定高效

  经过七年的磨刀,该软件不断更新和改进,速度快,性能稳定,资源少

  3、扩展性强,应用范围广

  自定义web发布,保存和发布主流数据库,自定义本地PHP和。Net外部编程接口来处理数据,以便您可以使用这些数据

  实现教程

  Open/Dede/Inc/Inc_uu归档文件uu在functions.php底部添加三个函数

  /*火车头采集自动更新主页*/

  function MakeIndex()

  {

  global $dsql,$cfg_basedir,$cfg_templets_dir,$cfg_df_style;

  require_once(DEDEINC.'/arc.partview.class.php');

  $envs = $_sys_globals = array();

  $envs['aid'] = 0;

  $pv = new PartView();

  $row = $pv->dsql->GetOne('SELECT * FROM `dede_homepageset`');

  $templet = str_replace("{style}", $cfg_df_style, $row['templet']);

  $homeFile = dirname(__FILE__).'/../'.$row['position'];

  $homeFile = str_replace("//", "/", str_replace("\\", "/", $homeFile));

  $fp = fopen($homeFile, 'w') or die("无法更新网站主页到:$homeFile 位置");

  fclose($fp);

  $tpl = $cfg_basedir.$cfg_templets_dir.'/'.$templet;

  if(!file_exists($tpl))

  {

  $tpl = $cfg_basedir.$cfg_templets_dir.'/default/index.htm';

  if(!file_exists($tpl)) exit("无法找到主页模板:$tpl ");

  }

  $GLOBALS['_arclistEnv'] = 'index';

  $pv->SetTemplet($tpl);

  $pv->SaveToHtml($homeFile);

  $pv->Close();

  }

  /*火车头采集自动更新栏目www.lol9.cn织梦六久阁*/

  function MakeParentType($typeid)

  {

  global $dsql;

  $typediarr = array();

  array_push($typediarr,$typeid);

  $row3 = $dsql->GetOne("Select reid,topid From `dede_arctype` where id=".$typeid);

  if(!in_array($row3['reid'],$typediarr) and $row3['reid']!=0) array_push($typediarr,$row3['reid']);

  if(!in_array($row3['topid'],$typediarr) and $row3['topid']!=0) array_push($typediarr,$row3['topid']);

  require_once(DEDEDATA."/cache/inc_catalog_base.inc");

  require_once(DEDEINC."/channelunit.func.php");

  require_once(DEDEINC."/arc.listview.class.php");

  foreach($typediarr as $typeid)

  {

  $lv = new ListView($typeid);

  $lv->MakeHtml(1,$maxpagesize);

  }

  }

  /*火车头采集自动更新上下篇*/

  function MakePreNext($aid,$typeid)

  {

  global $dsql;

  require_once(DEDEINC.'/arc.archives.class.php');

  $aid = intval($aid);

  $preRow = $dsql->GetOne("SELECT id FROM `dede_arctiny` WHERE id-1 AND typeid='$typeid' ORDER BY id DESC");

  $nextRow = $dsql->GetOne("SELECT id FROM `dede_arctiny` WHERE id>$aid AND arcrank>-1 AND typeid='$typeid' ORDER BY id ASC");

  if(is_array($preRow))

  {

  $envs['aid'] = $preRow['id'];

  $arc = new Archives($preRow['id']);

  $arc->MakeHtml();

  }

  if(is_array($nextRow))

  {

  $envs['aid'] = $nextRow['id'];

  $arc = new Archives($nextRow['id']);

  $arc->MakeHtml();

  }

  }

  继续在此文件中查找

  返回$revalue

  在下面加上

  MakePreNext($arcID,$typeid)

  MakeIndex()

  MakeParentType($typeid)

  加进去以后,是这样的

  

  添加后,无论是使用优采云免费登录界面还是web发布模块,无论是普通的文章模型、Atlas模型还是软件模型,都可以自动生成相关的静态文件

0 个评论

要回复文章请先登录注册


官方客服QQ群

微信人工客服

QQ人工客服


线