如何对接小发猫的伪原创API
什么小发猫的伪原创API?首先API(应用编程接口)允许一个软件与另一个软件对话。我们以旅游软件为例。当你需要从一个地点前往另一个地点时,出行软件会为你联系司机。司机会得到你在地图上的坐标,这样他们就可以很容易地导航到所需的位置。
小发猫伪原创API对接:
<?phpset_time_limit(270);
error_reporting(E_ERROR | E_WARNING | E_PARSE);define('TITLE_SEPAR', 'xxx**xxx');
define('TITLE_SEPAR2', '262661');# API需要自己去申请
$url = 'http://api.xiaofamao.com/api.php?json=0&v=1&key=1688baddu';$content_tag_name = '内容';$headdd = '';
$taill = '';switch($LabelArray['PageType'])
{case 'List'://处理列表页,只能处理htmlbreak;case 'Pages'://处理多页,只能处理htmlbreak;case 'Content'://处理默认页,只能处理htmlbreak;case 'Save'://只有保存时是可以处理标签值的// 保存原文try {/**********************************************************************/// 这一步用来获取伪原创文章/**********************************************************************/$title = $LabelArray['标题'];$title = '标题:'.$title;$content = $LabelArray[$content_tag_name];#$content = str_replace('2020/', '2020_', $content);$article_src = compose_article($title, $content);$article_src_b = $article_src;$article_new = get_wyc_article($article_src);$title_wyc = trim($article_new[0]);$content_wyc = trim($article_new[1]);$content_wyc = fix_newline($content_wyc);$content_wyc = str_replace('标签:', '标签:', $content_wyc);$LabelArray[$content_tag_name] = $headdd. $content_wyc. $taill;$title_wyc = str_replace(array('。',',','%'), array(' ',' ',' '), $title_wyc);$LabelArray['标题'] = $title_wyc;}catch (Exception $e) {$LabelArray['标题'] .= $e->getMessage();$LabelArray[$content_tag_name] .= $e->getMessage();}break;default://$LabelArray[$content_tag_name]=curl_request($url, array('wenzhang'=>$LabelArray[$content_tag_name] ));
}echo serialize($LabelArray);function compose_article($title, $content) {$separator = compose_separator();return $title.$separator.$content;
}function compose_separator() {return PHP_EOL.'('.TITLE_SEPAR2.')'.PHP_EOL;
}function fix_separator($article) {return $article;
}function get_wyc_article($str) {global $url;$separator = compose_separator();$separator = str_replace(PHP_EOL, '', $separator);$wyc = curl_request($url, array('wenzhang'=>$str));$wyc_f = $wyc;$wyc = fix_separator($wyc);$wyc = explode($separator, $wyc);if (isset($wyc[0])){$wyc[0] = str_replace('标题:', '', $wyc[0]);$wyc[0] = str_replace('标题:', '', $wyc[0]);$wyc[0] = str_replace('目:', '', $wyc[0]);$wyc[0] = str_replace('目:', '', $wyc[0]);$wyc[0] = 'xx`xx'.$wyc[0];$wyc[0] = str_replace('xx`xx题', '', $wyc[0]);$wyc[0] = str_replace('xx`xx', '', $wyc[0]);}//if (isset($wyc[1])) $wyc[1] = trim($wyc[1]);//$wyc[1] = $wyc_f.'jjjjjjjj'.$wyc[1];return $wyc;
}function get_wyc_title($str) {$title = get_wyc_article($str.PHP_EOL.PHP_EOL.PHP_EOL.$str.PHP_EOL.PHP_EOL.PHP_EOL.$str);$title = fix_newline($title);$title = explode(PHP_EOL, $title);return $title[0];
}function get_keywords($title, $contents) {$url_kw = 'http://api.78tp.com/nlp/kws.php?appid=';$kws = curl_request($url_kw, array('title'=>$title,'len'=>100,'text'=>$contents));return $kws;
}function remove_alt($contents) {$contents = preg_replace('/alt=\"(.*)\"/', '', $contents);return $contents;
}function fix_title($contents) {$punctuation_symbol = array('。', '?', ',', ':', ';', '、', '!','.', '?', ',', ':', ';', '!');$contents = str_replace($punctuation_symbol, '', $contents);return $contents;
}function br2newline($contents) {$contents = str_replace('<br>', PHP_EOL, $contents);$contents = str_replace('<br/>', PHP_EOL, $contents);$contents = str_replace('<br />', PHP_EOL, $contents);$contents = str_replace('<BR/>', PHP_EOL, $contents);$contents = str_replace('<BR>', PHP_EOL, $contents);$contents = str_replace('<BR />', PHP_EOL, $contents);return $contents;
}function newline2br($contnets) {$contnets = str_replace(PHP_EOL, "<br>", $contnets);
// $contnets = str_replace('><br><', '><', $contnets);$contnets = str_replace('<p><br>', '<p>', $contnets);return $contnets;
}function delete_newline($contents) {$contents = fix_newline($contents);
// $contents = str_replace(PHP_EOL.PHP_EOL, PHP_EOL, $contents);
// $contents = str_replace('>'.PHP_EOL, '>', $contents);return $contents;
}function reset_newline_win($contents) {// 优化换行符$contents = str_replace("\r\n", "\n", $contents);$contents = str_replace("\r", "\n", $contents);$contents = str_replace("\n", PHP_EOL, $contents);return $contents;
}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 clean_contents($contents) {
// $str = preg_replace('#<([^>\s/]+)[^>]*>#','<$1>', $contents);
// return $str;$sa = new cleanHtml; $sa->allow = array( 'src' ); $sa->exceptions = array( 'img' => array( 'src', 'alt' ), //'a' => array( 'href', 'title' ), 'iframe'=>array('src','frameborder'), ); $str = $sa->strip( $contents ); return $str;
}function xfm_strong_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;}
}//参数1:访问的URL,参数2:post数据(不填则为GET),参数3:提交的$cookies,参数4:是否返回$cookies
function curl_request($url,$post='',$cookie='', $returnCookie=0){if (! extension_loaded('curl')) {file_exists('./ext/php_curl.dll') && dl('php_curl.dll'); // 加载扩展}$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;}
}//echo $tag;
// 计算中文字符串长度
function utf8_strlen($string = null) {
// 将字符串分解为单元
preg_match_all("/./us", $string, $match);
// 返回单元个数
return count($match[0]);
}function reg_escape( $str )
{ $conversions = array( "^" => "\^", "[" => "\[", "." => "\.", "$" => "\$", "{" => "\{", "*" => "\*", "(" => "\(", "\\" => "\\\\", "/" => "\/", "+" => "\+", ")" => "\)", "|" => "\|", "?" => "\?", "<" => "\<", ">" => "\>" ); return strtr( $str, $conversions );
} /**
* Strip attribute Class
* Remove attributes from XML elements
* @author David (semlabs.co.uk)
* @version 0.2.1
*/ class cleanHtml{ public $str = ''; public $allow = array(); public $exceptions = array(); public $ignore = array(); public function strip( $str ) { $this->str = $str; if( is_string( $str ) && strlen( $str ) > 0 ) { $res = $this->findElements(); if( is_string( $res ) ) return $res; $nodes = $this->findAttributes( $res ); $this->removeAttributes( $nodes ); } return $this->str; } private function findElements() { # Create an array of elements with attributes $nodes = array(); preg_match_all( "/<([^ !\/\>\n]+)([^>]*)>/i", $this->str, $elements ); foreach( $elements[1] as $el_key => $element ) { if( $elements[2][$el_key] ) { $literal = $elements[0][$el_key]; $element_name = $elements[1][$el_key]; $attributes = $elements[2][$el_key]; if( is_array( $this->ignore ) && !in_array( $element_name, $this->ignore ) ) $nodes[] = array( 'literal' => $literal, 'name' => $element_name, 'attributes' => $attributes ); } } # Return the XML if there were no attributes to remove if( !$nodes[0] ) return $this->str; else return $nodes; } private function findAttributes( $nodes ) { # Extract attributes foreach( $nodes as &$node ) { preg_match_all( "/([^ =]+)\s*=\s*[\"|']{0,1}([^\"']*)[\"|']{0,1}/i", $node['attributes'], $attributes ); if( $attributes[1] ) { foreach( $attributes[1] as $att_key => $att ) { $literal = $attributes[0][$att_key]; $attribute_name = $attributes[1][$att_key]; $value = $attributes[2][$att_key]; $atts[] = array( 'literal' => $literal, 'name' => $attribute_name, 'value' => $value ); } } else $node['attributes'] = null; $node['attributes'] = $atts; unset( $atts ); } return $nodes; } private function removeAttributes( $nodes ) { # Remove unwanted attributes foreach( $nodes as $node ) { # Check if node has any attributes to be kept $node_name = $node['name']; $new_attributes = ''; if( is_array( $node['attributes'] ) ) { foreach( $node['attributes'] as $attribute ) { if( ( is_array( $this->allow ) && in_array( $attribute['name'], $this->allow ) ) || $this->isException( $node_name, $attribute['name'], $this->exceptions ) ) $new_attributes = $this->createAttributes( $new_attributes, $attribute['name'], $attribute['value'] ); } } $replacement = ( $new_attributes ) ? "<$node_name $new_attributes>" : "<$node_name>"; $this->str = preg_replace( '/'. reg_escape( $node['literal'] ) .'/', $replacement, $this->str ); } } private function isException( $element_name, $attribute_name, $exceptions ) { if( array_key_exists($element_name, $this->exceptions) ) { if( in_array( $attribute_name, $this->exceptions[$element_name] ) ) return true; } return false; } private function createAttributes( $new_attributes, $name, $value ) { if( $new_attributes ) $new_attributes .= " "; $new_attributes .= "$name=\"$value\""; return $new_attributes; } } ?>
但是旅游软件如何和地图沟通来推广这个呢?地图和旅游软件之间的数据传输是如何进行的?答案是API。旅游软件通过Maps API与地图软件Maps进行通信。这是一个比较古老的方法,网上不少人推荐,但是很影响论文的排版,现在基本上没效果了。
API已经存在了一段时间,但是直到最近人们才开始意识到他们有无数的用例来帮助实现业务目标。随着API的普及,设计和使用的标准化需求变得尤为突出。
OpenAPI规范(OAS)成为实现这一目标的关键。
本质上,OAS是一组规则,用于定义API的契约,指定资源和相应的响应请求周期。
有同学可能会问:那要是我熬夜降重,突然大脑短路,想不到可替换的近义词了怎么办?
在实现和使用API的时候,OpenAPI可以带来一些很大的好处,比如质量更好,应用更快。
OAS的美妙之处在于,有了它,每个使用你的API的人都会明白它应该做什么,以及它与他们的工作有什么关系。
这将减少团队之间的依赖,从而更快地进入市场。更好的开发者体验。
这是开发者在使用软件时所有经验的总和。在今天的竞争环境中,拥有积极的开发经验可能会使新项目成功。文章字体这里不行那里不行,简直都要改疯了,再提交论文检测也是非常麻烦大家可以通过前出塞进行查重。
它们为什么重要?
我们为什么要关心API?而API和OpenAPI规范的兴起,给组织带来了一些很大的好处。驱动程序平台:通过将不同的软件应用程序连接在一起,API还允许第三方开发人员在现有产品和服务的基础上进行开发。这将创建一个可扩展的平台生态系统,以最低的成本增强您对客户的服务。推动业务发展:正如地图数据对旅游软件有用一样,组织数据对其他人构建或增强自己的产品也很有用。使用API,公司可以披露对他人有益的重要数据。基于公布数据的重要性,围绕API的各种商业模式也随之发展起来,从而帮助他们通过API实现公司增长和业务收入。
技术:创建和更新特性的速度可以决定产品策略的成败。拥有运行良好的内部技术栈以及团队和软件组件之间的有效沟通,可以实现开发速度和效率。API帮助不同的内部组件更好地进行通信,并已成为微服务和无服务器等新的和改进的架构的基础。上面主要用到了近义词替换和增删细节等方式,结果不仅是重复率下降,字数也有所增加。
如何对接小发猫的伪原创API相关推荐
- 小发猫物联网平台搭建与应用模型
共享干衣机物联网平台阅洁科技获千万级人民币A轮融资 DoNews 9月2日消息(程梦玲)共享干衣机物联网平台「阅洁科技」已于近日完成千万级人民币A轮融资,由中山天骏独家投资,本轮融资将用于供应链搭建与 ...
- 全民小视频视频搬运伪原创
全民小视频视频搬运伪原创 特别是,一些较大的媒体平台(标题,数百人,企鹅等)将看到他们的一些逻辑,这使得这个视频播放如此之高.,许多小伙伴都知道,今天的头条新闻可以 ...
- php伪原创api对接方法
今天总结一下我的php伪原创api对接方法,首先我们知道PHP是PHP超文本预处理器(超文本和处理器)的缩写,惊蛰节到闻雷声,震醒蛰伏越冬虫.这种方法称为递归缩写,若机会不来敲你的门,那就自己开启那扇 ...
- 基于AI伪原创API的python伪原创工具开发
功能上分别具有4种ai智能算法,在线伪原创,批量伪原创,自定义文本替换等功能,自定义锁词,在线API功能.可以对接采集工具和个人网站使用.智能改写后的文章具有可读性高,原创度高的特点,对各大搜索引擎都 ...
- 文章伪原创API接口
完全免费的伪原创接口 接口:http://api.ziyuanhe.cn/api/wyc?apiKey=a09ac290df0fb7d62f2260dcf8a39941 参数 info 是 strin ...
- java达内小发猫课程,详细说明
达内教育首次推出Spring中文版认证体系及课程这也是Spring认证课程的首次汉化.据悉,Java是全球IT语言排行榜上的"热宠",而Spring则是基于Java开发的开源框架, ...
- 批量伪原创工具-伪原创api-伪原创
相信很多做网站优化的人或多或少都知道伪原创,那什么是伪原创呢?我们如何确定一篇文章是否为伪原创?对于没搞过这个的建议先看看从哪里入手SEO内容让自己有个基本的了解. 一个搜索引擎网站内容检测的时候有两 ...
- 爱发猫自动建站程序,自动发布,自动推送,自动收录
只要指定一组长尾词,自动建站系统会围绕这组长尾词继续挖掘长尾词并生成标题和内容. 包括内链系统,百度推送,自动图片. 爱发猫自助建站系统介绍https://www.zgybz.com/?id=12 购 ...
- seo伪原创工具_文章伪原创工具哪个好用(伪原创工具有哪些)
从事网站seo优化的工作基本上每天都会和文章打交道,因为网站的排名与网站的收录关系是非常大的,网站的收录又和文章息息相关,搜索引擎的胃口是比较喜欢新的内容.原创的内容,而对于一些文案功底比较没那么好的 ...
- seo伪原创工具_伪原创工具哪个好用?
在日常优化工作过程中,一个站长是需要同时管理好几个网站的,所以导致没有时间或精力写出更多的原创内容,在这个时候就需要借助伪原创工具来实现内容更新的目的了,比较实用的伪原创工具主要有:石青.小发猫.魔术 ...
最新文章
- WINCE config.bib文件中的FSRAMPERCENT的意义
- 2.1 词汇表征-深度学习第五课《序列模型》-Stanford吴恩达教授
- plc tcp ip通讯怎么只能连一个客户端_浅谈西门子plc的profinet功能的开放式通信功能...
- 使用组策略中的首选项更改域中计算机注册表
- 如何将iPhone应用程序从应用程序库移动到主屏幕
- python中MySQLdb模块用法实例
- 秋招开始,求职别慌!C 认证了解一下!
- SSM Controller 页面之间跳转 重定向,有参 无参问题
- 9位工作流业内专家联袂推荐
- BZOJ 4503 两个串 ——FFT
- android4.0以上,利用耳机接听键实现自动接听,部分手机失败原因+解决方法(比如华为P7)
- Python Roberts算子、Sobel算子——举例说明 ^_^
- java obj_java中的 compareTo(Object obj)的obj怎么理解
- VuePress开启评论、VuePress评论功能。
- html页面的dtd是什么意思,html dtd文件解释
- [干货] 一文看懂numpy.nonzero() 与 numpy.argwhere()非零元素处理
- python爬取豆瓣电影并分析_Python实战之如何爬取豆瓣电影?本文教你
- Juniper设备标准配置
- 爬取网站时返回的html是乱码问题解决
- Ubuntu进不去图形化界面的解决方案