火车头采集器AI伪原创[php源码]

本文介绍php版本的火车头采集器AI伪原创,对于网站的原创内容,站长朋友们一定很头疼。作为一个草根站长,自己写原创文章太累了。当然,我并不是说你不能写。自己写原创文章是不现实的。时间是最大的问题。

 也许有的站长朋友会问:ai伪原创api,不写原创文章,如何获得更好的排名网站呢?

其实不光是我们,国内几大门户网站也不都是原创文章。他们还利用其他平台的内容进行修改,然后更改标题,从而成为他们自己的“新闻”。

<?php
header("Content-type: text/html; charset=gb2312");
set_time_limit(0);error_reporting(E_ALL); 
ini_set('display_errors', '1'); define ("CUR_DIR", '../');
define('TITLE_SEPAR', 'xxxxx');// 这里是你的API地址
define('API_URL', 'http://api.xiaofamao.com/api.php?json=0&v=2&key=yuyu');// 待执行目录
define('CUR_FOLDER', CUR_DIR.'word');
// 执行后保存目录
define('DEST_FOLDER', CUR_DIR.'xiaofamao');
// 执行后保存目录 失败
define('DEST_FOLDER_FAIL', CUR_DIR.'xiaofamao_fail');$one_file = get_one_file();// 判断是否还有任务
if (!$one_file){echo PHP_EOL.'* 任务数为0, 程序已退出';exit;
}while ($one_file) {echo PHP_EOL.'* 正在执行:' . PHP_EOL. file_path($one_file);echo PHP_EOL.'* 请耐心等候...';$data_arr = get_contents_filter(file_path($one_file));$title = $data_arr['title'];$title_src = $data_arr['title'];$content = $data_arr['content'];$content = replace_shuminghao($content);$content = get_utf8_data($content);$new_content = curl_request(API_URL, array('wenzhang'=>$content));$new_content = get_gbk_data($new_content);$new_content = restore_shuminghao($new_content);#var_dump($new_content);$new_content = content_format($new_content);$new_content = $new_content;#$new_title = get_ai_title($title);$title = get_utf8_data($title);$new_title = $title;//$new_title =curl_request(API_URL, array('wenzhang'=>$title));//$new_title = get_gbk_data($new_title);#echo $new_title;# 如果标题伪原创成功if ($new_title === 'xx'.$title) {$new_title = get_gbk_data($title);//save_new_file(DEST_FOLDER_FAIL.DIRECTORY_SEPARATOR.$new_title.'.txt', $new_content);save_new_file(DEST_FOLDER_FAIL.DIRECTORY_SEPARATOR.$title_src.'.txt', $new_content);}else {$new_title = strip_tags($new_title);$new_title = str_replace(':', ":", $new_title);$new_title = str_replace('?', "?", $new_title);$new_title = str_replace(array('*','"','<','>','|'),'_', $new_title);$new_title = get_gbk_data($new_title);#$title = get_gbk_data($title);#save_new_file(DEST_FOLDER.DIRECTORY_SEPARATOR.$new_title.'.txt', $new_content);save_new_file(DEST_FOLDER.DIRECTORY_SEPARATOR.$title_src.'.txt', $new_content);#save_new_file(DEST_FOLDER.DIRECTORY_SEPARATOR.$new_title.'.txt', $content);}////#save_new_file(DEST_FOLDER.DIRECTORY_SEPARATOR.$title.'.txt', $new_content);file_ok($one_file);//show_info_gb2312('伪原创结果:'.PHP_EOL. $final_data);//save_new_file(DEST_FOLDER.DIRECTORY_SEPARATOR.$new_title, $new_content);//var_dump($final_data);//    sleep(3);$one_file = get_one_file();
//    show_reflesh();
}show_info_gb2312(PHP_EOL.'任务完成'.PHP_EOL);function replace_shuminghao($content) {$content = str_replace('![](', '<(', $content);$count = preg_match_all("/<\((.*?)\)/", $content, $matches);#var_dump($matches[0]);if (isset($matches[0][0])){foreach ($matches[0] as $key => $value) {#echo $value;$new_val = '《'.$matches[1][$key].'》';$content = str_replace($value, $new_val, $content);}}
#echo $content;return $content;
}function restore_shuminghao($content) {$count = preg_match_all("/《http(.*?)》/", $content, $matches);#var_dump($matches[0]);if (isset($matches[0][0])){foreach ($matches[0] as $key => $value) {$new_val = '![](http'.$matches[1][$key].')';$content = str_replace($value, $new_val, $content);}#return $matches[0];}return $content;
}function content_rewrite($content) {$data = curl_request(API_URL, array('wenzhang'=>$content));return $data;
}function content_format($data) {$data = fix_newline($data);$data_arr = explode(PHP_EOL, $data);$ret_str = '';foreach($data_arr as $key => $value) {
#echo $value;$ret_str .= '  '.$value.PHP_EOL.PHP_EOL;#$ret_str .= 'bbbbbbbbbbbbbbbbbb';}return $ret_str;
}function title_content_rewrite($title, $content) {$article_src = $title.TITLE_SEPAR.PHP_EOL.$content;$data = curl_request(API_URL, array('wenzhang'=>$article_src));$data = str_replace("Xx", "xx", $data);$data = str_replace("\n", "\r\n", $data);$data = str_replace("<p>\r\n", "<p>", $data);$data = ltrim($data);#var_dump($data);$temp = explode(TITLE_SEPAR, $data);#var_dump($temp);$temp[0] = trim($temp[0]);$temp[1] = ltrim($temp[1]);$temp[1] = ltrim($temp[1], '</p>');$temp[1] = ltrim($temp[1]);$temp[1] = ltrim($temp[1]);return $temp;
}function show_info($str) {echo '<p>' . $str . '</p>';
}function get_utf8_data($data) {$encode = mb_detect_encoding($data, array('ASCII', 'UTF-8', 'GB2312', 'GBK','BIG5'));if ($encode !== 'UTF-8') {//show_info_gb2312('文件非 UTF-8,正在转成UTF-8');$utf8_data = iconv($encode, 'UTF-8//IGNORE', $data);return $utf8_data;}return $data;
}function get_gbk_data($data) {$encode = mb_detect_encoding($data, array('ASCII', 'UTF-8', 'GB2312', 'GBK','BIG5'));if ($encode === 'UTF-8') {//show_info_gb2312('文件非 UTF-8,正在转成UTF-8');$gbk_data = iconv('UTF-8//IGNORE', 'GBK//IGNORE', $data);return $gbk_data;}return $data;
}function get_ai_title($title) {$title = urlencode($title);return curl_request($url);
}function show_info_gb2312($string) {echo get_gbk_data($string);newline();
}function get_img_arr($array) {$ret_arr = array();foreach ($array[1] as $key => $value) {if (stripos($value, 'C:\\') === 0) {$ret_arr[0][] = $value;}else {$ret_arr[1][] = $value;}}asort($ret_arr);return $ret_arr;
}function str_replace_once($search, $replace, $subject) {$firstChar = strpos($subject, $search);if($firstChar !== false) {$beforeStr = substr($subject,0,$firstChar);$afterStr = substr($subject, $firstChar + strlen($search));return $beforeStr.$replace.$afterStr;} else {return $subject;}
}//var_dump(str_replace_once('**x**', 'xxxxxxxxxx', 'aaa**x**bbb'));
//exit;
function put_img_arr($array, $string) {$string = str_replace('**X**', '**x**', $string);foreach ($array as $key => $value) {$string = str_replace_once('**x**', $value, $string);}return $string;
}function get_rewrite_title($data) {
//    var_dump($data);$data = reset_newline($data);$data_arr = explode(PHP_EOL, $data);$title = str_replace(array('<P>', '<p>'), array('',''), $data_arr[0]);array_shift($data_arr);$contents = '<p>'.implode(PHP_EOL, $data_arr);$new_arr = array($title, $contents);return $new_arr;
}/*
foreach ($news_list as $key => $value) {echo $value."<br>".PHP_EOL;$value = iconv("utf-8", "gb2312", $value);$data = file_get_contents($value);$data = iconv("GBK", "utf-8", $data);
//	echo $data;$data = rewrite($data);$data = str_replace("\r\n", "\n", $data);$data = str_replace("\r", "\n", $data);$data = str_replace("\n", "\r\n", $data);sleep(2);$data = auto_typeset($data);save_new_file('b'.$value, $data);
}
*/function auto_typeset($data) {$data = str_replace(array('<P>'."\r\n", '<P>', '<p>'),array('<p>',        '<p>', '<p>  '),$data);return $data;
}function rewrite($article) {$url = API_URL;return curl_request($url, array('wenzhang'=>$article ));
}function save_new_file($filename, $data) {if (! data_exists($filename)) {file_put_contents($filename, $data);}
}// 缓存数据是否存在
function data_exists($filename) {$filename = str_replace('\\','/', $filename);
//    var_dump($filename);
//    var_dump(dirname($filename));if (!is_dir(dirname($filename))) {
//    echo 'aaaaaaaaaaa';mkdir(dirname($filename),0755,true);}
//  var_dump(dirname(dirname($filename)));if (!is_dir(dirname(dirname($filename)))) {
//        echo 'bbbbbbbbbb';mkdir(dirname(dirname($filename)),0755,true);}if (file_exists($filename)) {return true;}return false;
}function get_news_list($floder) {$news_list = array();if($handle = opendir($floder)){while (false !== ($file = readdir($handle))){//$dir = iconv("utf-8", "gb2312", $file);$file = iconv("gb2312", "utf-8", $file);if ($file !== '..' && $file !== '.'){$news_list[] = $floder.DIRECTORY_SEPARATOR.$file;}//    echo "$file\n";}closedir($handle);}return $news_list;
}//参数1:访问的URL,参数2:post数据(不填则为GET),参数3:提交的$cookies,参数4:是否返回$cookies
function curl_request($url,$post='',$cookie='', $returnCookie=0){$curl = curl_init();curl_setopt($curl, CURLOPT_URL, $url);curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)');if (ini_get('open_basedir') == '' && strtolower(ini_get('safe_mode')) != 'on'){ curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);}curl_setopt($curl, CURLOPT_AUTOREFERER, 1);curl_setopt($curl, CURLOPT_REFERER, "http://XXX");if($post) {curl_setopt($curl, CURLOPT_POST, 1);curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));}if($cookie) {curl_setopt($curl, CURLOPT_COOKIE, $cookie);}curl_setopt($curl, CURLOPT_HEADER, $returnCookie);curl_setopt($curl, CURLOPT_TIMEOUT, 150);curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);$data = curl_exec($curl);if (curl_errno($curl)) {return curl_error($curl);}curl_close($curl);if($returnCookie){list($header, $body) = explode("\r\n\r\n", $data, 2);preg_match_all("/Set\-Cookie:([^;]*);/", $header, $matches);$info['cookie']  = substr($matches[1][0], 1);$info['content'] = $body;return $info;}else{return $data;}
}// 计算中文字符串长度
function utf8_strlen($string = null) {
// 将字符串分解为单元
preg_match_all("/./us", $string, $match);
// 返回单元个数
return count($match[0]);
}function get_one_file() {$arr_all = get_all_files();#var_dump( $arr_all );$arr_ok = get_ok_files();//var_dump($arr_ok);foreach($arr_all as $v) {if (array_search($v, $arr_ok)===false) {return $v;}}return false;
}function get_all_files() {return listDir(CUR_FOLDER);
}function get_ok_files() {//var_dump(CUR_DIR.'ok.txt');$data = file_get_contents(CUR_DIR.'ok.txt');$data = str_replace("\xef\xbb\xbf", '', $data);$data_arr = explode(PHP_EOL, $data);return $data_arr;
}function file_ok($file_name) {file_put_contents(CUR_DIR.'ok.txt', $file_name.PHP_EOL, FILE_APPEND);
}function listDir($dir)
{
//    echo $dir;$reta = array();if(is_dir($dir)){if ($dh = opendir($dir)) {while (($file = readdir($dh)) !== false){if((is_dir($dir."/".$file)) && $file!="." && $file!=".."){//echo 'aa';//$file = iconv("gb2312", "utf-8//IGNORE", $file);//    $file = ConvertToUTF8($file);#$file = mb_convert_encoding($file, 'UTF-8', 'GBK');$reta[] = $file;//    echo "<b><font color='red'>文件名:</font></b>",$file,"<br><hr>";listDir($dir."/".$file."/");}else{if($file!="." && $file!=".."){//    echo $file."<br>";if (stripos($file, '.txt')!==false) {#$file = iconv("GBK", "utf-8//IGNORE", $file);//    echo $file.'<br>';$reta[] = $file;}}}}closedir($dh);}}
//var_dump($reta);return $reta;
}function file_path($filename) {return CUR_FOLDER.DIRECTORY_SEPARATOR.$filename;
}function short_filename($filename) {$filename = str_replace(CUR_FOLDER.DIRECTORY_SEPARATOR, '', $filename);$filename = str_replace('.txt', '', $filename);return $filename;
}function get_contents_filter($file_name) {$file_name = get_gbk_data($file_name);
//    $file_name = mb_convert_encoding($file_name, 'UTF-8', 'ISO-8859-15');
///    $file_name = iconv("utf-8", "GBK//IGNORE", $file_name);
//    echo $file_name.'<br>';$data = file_get_contents($file_name);$data = get_gbk_data($data);$data = str_replace("\t", '', $data);// 优化换行符$data = fix_newline($data);$data_title = short_filename($file_name);
//var_dump(get_utf8_data($data));return array('title'=>$data_title, 'content'=>$data);
}function fix_newline($data) {$data = str_replace("\r", "\n", $data);while(strpos($data, "\n\n") !== false) {$data = str_replace("\n\n", "\n", $data);}$data = str_replace("\n", PHP_EOL, $data);return $data;
}function show_reflesh() {
$str = '<script language="JavaScript">
function myrefresh()
{window.location.reload();
}
setTimeout("myrefresh()",1000);
</script>';
echo $str;
}function after ($this, $inthat){if (!is_bool(strpos($inthat, $this)))return substr($inthat, strpos($inthat,$this)+strlen($this));};function after_last ($this, $inthat){if (!is_bool(strrevpos($inthat, $this)))return substr($inthat, strrevpos($inthat, $this)+strlen($this));};function before ($this, $inthat){return substr($inthat, 0, strpos($inthat, $this));};function before_last ($this, $inthat){return substr($inthat, 0, strrevpos($inthat, $this));};function between ($this, $that, $inthat){return before ($that, after($this, $inthat));};function between_last ($this, $that, $inthat){return after_last($this, before_last($that, $inthat));};// use strrevpos function in case your php version does not include it
function strrevpos($instr, $needle)
{$rev_pos = strpos (strrev($instr), strrev($needle));if ($rev_pos===false) return false;else return strlen($instr) - $rev_pos - strlen($needle);
};function recurse_copy($src,$dst) { $dir = opendir($src); @mkdir($dst); while(false !== ( $file = readdir($dir)) ) { if (( $file != '.' ) && ( $file != '..' )) { if ( is_dir($src . '/' . $file) ) { recurse_copy($src . '/' . $file,$dst . '/' . $file); } else { if (strpos($file, '.txt') === false) {copy($src . '/' . $file,$dst . '/' . $file);}} } } closedir($dir); 
} function ConvertToUTF8($text){$encoding = mb_detect_encoding($text, mb_detect_order(), false);if($encoding == "UTF-8"){$text = mb_convert_encoding($text, 'UTF-8', 'UTF-8');    }$out = iconv(mb_detect_encoding($text, mb_detect_order(), false), "UTF-8//IGNORE", $text);return $out;
}function newline() {echo PHP_EOL;
}function sanitizeUTF8($value){if (self::getIsIconvEnabled()) {// NEW ----------------------------------------------------------------$encoding = mb_detect_encoding($value, mb_detect_order(), false);if($encoding == "UTF-8"){$value = mb_convert_encoding($value, 'UTF-8', 'UTF-8');    }$value = iconv(mb_detect_encoding($value, mb_detect_order(), false), "UTF-8//IGNORE", $value);// --------------------------------------------------------------------// OLD --------------------------------------// $value = @iconv('UTF-8', 'UTF-8', $value);// -------------------------------------------return $value;}$value = mb_convert_encoding($value, 'UTF-8', 'UTF-8');return $value;}?>

有朋友问我,这样做网站会被K吗?是作弊吗?

就这个问题,我想发表一下我个人的看法,供大家参考。搜索引擎毕竟是机器,在抓取一篇文章后,它们会将其与数据库中的现有文章进行比较。如果他们发现一篇文章相似度很高,就会被认为是抄袭,否则就会被认为是原创。

当然,如果照搬的话,那就一定是抄袭了。使用AI伪原创工具转换不仅仅是将文章内容转换为同义词,而是通过AI技术根据文章内容重新创建,并根据文章的结构和内容重新创建。文章发生了彻底的改变。如果搜索引擎抓取到它,它就被认为是原创文章。所以您可以放心使用。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/13247.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Zabbix(二)

Zabbix(二) 一、部署代理服务器 1.作用 分布式监控的作用&#xff1a; ●分担 server 的集中式压力 ●解决多机房之间的网络延时问题2.步骤 2.1部署代理服务器端 systemctl disable --now firewalld setenforce 0 hostnamectl set-hostname zbx-proxy//设置 zabbix 的下载…

【数据结构】双向带头循环链表

⭐️ 往期相关文章 ✨链接1&#xff1a;数据结构和算法的概念以及时间复杂度空间复杂度详解 ✨链接2&#xff1a;【数据结构】手撕顺序表(动态版)代码详解 ✨链接3&#xff1a;【数据结构】手撕单链表代码详解 ⭐️ 双向带头循环链表 图解&#xff1a; 双向&#xff1a; 链表…

LVS简介及LVS-NAT负载均衡群集的搭建

目录 一、LVS群集简介 1.群集的含义和应用场景 2.性能扩展方式 3.群集的分类 负载均衡&#xff08;LB&#xff09; 高可用&#xff08;HA&#xff09; 高性能运算&#xff08;HPC&#xff09; 二、LVS负载均衡群集简介及搭建 1.负载均衡群集架构 2.三种工作模式 3.启…

C++教程(一)开发环境visual studio的安装——图文详细

一、visual studio下载地址&#xff1a; 1、百度网盘 链接&#xff1a;https://pan.baidu.com/s/1QJosSoAT7EumuvyjtC_1Iw?pwdwuqz 提取码&#xff1a;wuqz 2、官网下载 Visual Studio: 面向软件开发人员和 Teams 的 IDE 和代码编辑器 (microsoft.com)https://visualstudio.…

python flask sqlite http服务

python flask 服务 为了让拼接项目能够简单实用http服务&#xff0c;用python flask 来做一个http服务&#xff0c;使用python的原因是拼接项目本身很多人工智能的服务是用python来写。数据库为了简单实用sqlite&#xff0c;python自带sqlite3 ,很方便 db.sql CREATE TABLE …

uni-app

uni-app 一、准备工作1.新建项目2.配置浏览器3.兼容4.新建页面 二、上手1.pages.json文件的页面配置与全局配置2.rpx尺寸单位3.内置组件4.vue2写法&#xff08;1&#xff09;模板&#xff08;2&#xff09;插值语法&#xff08;3&#xff09;指令&#xff08;4&#xff09;styl…

猿人学web刷题1

1.第一题 js混淆源码乱码 - 猿人学 : url 时间戳加密 右键遇到反调试&#xff0c;参考前面的文章 过反调试 2.ast解混淆 首页1.js 拿到 function oo0O0, 在<script>标签里面, 无法调试&#xff0c;分析自己提取出来&#xff0c;或则hook替换 加密逻辑存在于window.a中&a…

分布式概念

分布式系统中的相关概念 1 大型互联网项目架构目标 2 集群和分布式 替换模块 3 架构演进

代码随想录day11

20. 有效的括号 思路&#xff1a;这里用模拟栈的方法会更好理解&#xff0c;也就是我们每次遇到朝左方向的三种类型的时候&#xff0c;就加入相反方向的右括号到result栈中。由于栈是一个先进后出的方式&#xff0c;所以我们会有一个判断stack当前为不为空&#xff0c;和stack[…

大型语言模型与知识图谱协同研究综述:两大技术优势互补

机器之心报道 编辑&#xff1a;杜伟 多图综述理清当前研究现状&#xff0c;这篇 29 页的论文值得一读。 大型语言模型&#xff08;LLM&#xff09;已经很强了&#xff0c;但还可以更强。通过结合知识图谱&#xff0c;LLM 有望解决缺乏事实知识、幻觉和可解释性等诸多问题&am…

JVM源码剖析之SymbolTable和StringTable

很多读者在观看JVM相关的书籍时会看到SymbolTable和StringTable&#xff0c;书中的三言二语介绍的不是很清楚&#xff0c;并且读者的水平有限&#xff0c;导致无法理解SymbolTable和StringTable。所以特意写此篇图文并茂的文章来彻底理解SymbolTable和StringTable这两张表。 版…

mac电脑上,webm格式怎么转换成mp4?

mac电脑上&#xff0c;webm格式怎么转换成mp4&#xff1f;webm格式的视频也是最近几年也越来越多的&#xff0c;小编最近就不止一次的下载到过webm格式的视频&#xff0c;很多小伙伴肯定对它还并不是很了解&#xff0c;webm是由谷歌公司所提出以及开发出来的视频文件格式&#…