织梦插件开发:织梦自动采集插件来啦!织梦文章采集插件,织梦一键采集微信公众号文章。免费一键采集,轻松获取高质量文章,让你轻松搞定网站更新。
演示图片
适用于 DedeBIZ、DeDeCMS 织梦任何版本,包含市面上的N款编辑器。比如下列编辑器:
WangEditor、UEditor、UEditorPlus、KindEditor、Markdown、TinyMCE、CKEditor
复制单篇文章,一键获取公众号文章内容至编辑器,发布文章时你只需点击一下就行了。
API接口说明
http://nidecms.com/bt/www_wxapi.php?url="+wxurl+"&pic=1&ms=1&zz=1&ww=1
这个就是API接口啦!下面是参数说明
pic=1 采集缩略图
ms=1 采集描述
zz=1 采集作者
ww=1 清除文章样式
http://nidecms.com/bt/www_wxapi.php?url="+wxurl+"&pic=0&ms=0&zz=0&ww=0
pic=0 不采集缩略图
ms=0 不采集描述
zz=0 不采集作者
ww=0 不清除文章样式
http://nidecms.com/bt/www_wxapi.php?url="+wxurl+"
当然也可以这样就行,这样就是只采集标题和文章内容。
DedeBIZ对接教程
1、打开 /admin/templets/article_add.htm 看到33-37行
<tr> <td width="120">文档标题:</td> <td width="390"><input type="text" name="title" id="title" value="<?php echo $title;?>" class="admin-input-lg"></td> <td width="120">简略标题:</td> <td><input type="text" name="shorttitle" id="shorttitle" class="admin-input-sm"></td> </tr>
改为
<tr> <td width="120">文档标题:</td> <td width="390"><input type="text" name="title" id="title" value="<?php echo $title;?>" class="admin-input-lg"></td> <td width="90">简略标题:</td> <td width="100"><input type="text" name="shorttitle" id="shorttitle" class="admin-input-sm"></td> <td width="110">  文章采集:</td> <td><input type="text" name="wxurl" id="wxurl" class="admin-input-sm" placeholder="微信众号文章URL链接" style="width:150px;"> <button type="button" class="btn btn-success btn-sm" onClick="weixin();" style="padding: .25rem .5rem;">一键获取微信公众号文章内容</button> <span id="uuxt" style="color:red;"></span> </td> </tr>
2、还是该文件,滑到最底部,在 </body> 的前面加入
<script type="text/javascript"> function weixin() { var wxurl = $("#wxurl").val(); $.ajax({ url: "http://nidecms.com/bt/www_wxapi.php?url="+wxurl+"&pic=1&ms=1&zz=1&ww=0",/*根据需求填写API接口*/ type: "POST", data: {wxurl: wxurl}, dataType: "JSON", success: function (result) { $("#title").val(result.title); $("#picname").val(result.img); $("#writer").val(result.writer); $("#description").val(result.description); <?php echo ($cfg_html_editor == 'ueditor' || $cfg_html_editor == 'ueditorplus') ? "UE.getEditor('body').execCommand('insertHtml',result.body);".PHP_EOL : "editor.setData(result.body);".PHP_EOL; ?> $("#uuxt").html(result.wek); },error: function (xhr, status, error) { $("#uuxt").html(result.wek); }, }); } </script>
PS:注意接口,接口在上面,根据自己的需求填写就行了。
3、打开 /admin/inc/inc_archives_functions.php 搜索
$body = addslashes($body);
在 579 行,在它上面加入
$body = str_replace('<meta name="referrer" content="never">','', $body);
完成。
DeDeCMS对接教程
1、打开 /admin/templets/article_add.htm 搜索
<script language="javascript" src="../include/js/jquery/jquery.js"></script>
这个 jQuery 过于老旧,得换一个,下载本站的也行,下载百度的也行。
<script language='javascript' src="https://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
2、还是这个文件,看到 210-217 行
<tr> <td width="90"> 文章标题:</td> <td width='408'><input name="title" type="text" id="title" value="<?php echo $title; ?>" style="width:388px" /></td> <td width="90"> 简略标题:</td> <td><input name="shorttitle" type="text" id="shorttitle" style="width:150px" /> </td> </tr>
改为
<tr> <td width="90"> 文章标题:</td> <td width='408'><input name="title" type="text" id="title" value="<?php echo $title; ?>" style="width:388px" /></td> <td width="90"> 简略标题:</td> <td><input name="shorttitle" type="text" id="shorttitle" style="width:150px" /> </td> <td width="120">  文章采集:</td> <td><input type="text" name="wxurl" id="wxurl" class="admin-input-sm" placeholder="粘贴公众号文章URL链接" style="width:200px;"> <button type="button" class="np coolbg" onClick="weixin();" style="padding: .25rem .5rem;">一键获取微信公众号文章内容</button> <span id="uuxt" style="color:red;"></span> </td> </tr>
3、还是该文件,滑到最底部,在 </body> 的前面加入
<script type="text/javascript"> function weixin() { var wxurl = $("#wxurl").val(); $.ajax({ url: "http://nidecms.com/bt/www_wxapi.php?url="+wxurl+"&pic=1&ms=1&zz=1&ww=0",/*根据需求填写API接口*/ type: "POST", data: {wxurl: wxurl}, dataType: "JSON", success: function (result) { $("#title").val(result.title); $("#picname").val(result.img); $("#writer").val(result.writer); $("#description").val(result.description); <?php if ($cfg_html_editor == 'wangEditor') { echo "bodyeditor.setHtml(result.body);".PHP_EOL; } else if ($cfg_html_editor == 'ueditor' || $cfg_html_editor == 'ueditorplus') { echo "UE.getEditor('body').execCommand('insertHtml',result.body);".PHP_EOL; } else if ($cfg_html_editor == 'kindeditor') { echo "editor1.html(result.body);".PHP_EOL; } else if ($cfg_html_editor == 'markdown') { echo "markdowneditor.setValue(result.body);".PHP_EOL; } else if ($cfg_html_editor == 'tinymce') { echo "tinymce.activeEditor.setContent(result.body);".PHP_EOL; } else { echo "var editor = CKEDITOR.instances['body'];\neditor.setData(result.body);".PHP_EOL; } ?> $("#uuxt").html(result.wek); },error: function (xhr, status, error) { $("#uuxt").html(result.wek); }, }); } </script>
PS:注意接口,接口在上面,根据自己的需求填写就行了。
4、打开 /dede/inc/inc_archives_functions.php 搜索
$body = addslashes($body);
在 714 行,在它上面加入
$body = str_replace('<meta name="referrer" content="never">','', $body);
完成。
温馨提示
只需要简单的操作,然后复制你需求的接口就行了,采集就是这么简单。
插件下载
写在最后
就这样吧,反正都是免费的。还是那句话:年少不知本站好,白首方悔资源少。
登录后方可回帖