分类 其他 下的文章

在Pipelines中新建以下类

class PostApiPipeline(object):
    async def process_item(self, item, spider):
        request=scrapy.Request("xxxx/api.php", method="POST", body=json.dumps(dict(item)), headers={'Content-Type': 'application/json'})
        response = await spider.crawler.engine.download(request, spider)
        return item

1、打开e/class/functions.php
2、查找'/'.$r[keyname].'/i'替换为'/'.$r[keyname].'(?!(1>)|(1< a="">))/i'

function ReplaceKey($newstext,$classid=0){
global $empire,$dbtbpre,$public_r,$class_r;
if(empty($newstext)||$class_r[$classid]['keycid']==-1)
{return $newstext;}
$where=' where keyurl!=""';
if(!empty($class_r[$classid]['keycid']))
{
    $where=" where keyurl!='' and cid='".$class_r[$classid]['keycid']."'";
}
$sql=$empire->query("select keyname,keyurl from {$dbtbpre}enewskey".$where);
while($r=$empire->fetch($sql))
{
    if(STR_IREPLACE)
    {
        $newstext=empty($public_r[repkeynum])?str_ireplace($r[keyname],'<a href='.$r[keyurl].' target=_blank class=infotextkey>'.$r[keyname].'</a>',$newstext):preg_replace('/'.$r[keyname].'(?!([^<]*>)|([^<]*<\ a="">))/i','<a href='.$r[keyurl].' target=_blank class=infotextkey>'.$r[keyname].'</a>',$newstext,$public_r[repkeynum]);
    }
    else
    {
        $newstext=empty($public_r[repkeynum])?str_replace($r[keyname],'<a href='.$r[keyurl].' target=_blank class=infotextkey>'.$r[keyname].'</a>',$newstext):preg_replace('/'.$r[keyname].'(?!([^<]*>)|([^<]*<\ a="">))/i','<a href='.$r[keyurl].' target=_blank class=infotextkey>'.$r[keyname].'</a>',$newstext,$public_r[repkeynum]);
    }
}
return $newstext;

}


  1. <