如何检测SEO文章原创度

自媒体 投稿&转载 1161浏览

过程:

1)先把一篇文章,按逗号分隔成一个一个短语

2)然后计算每个短语的字数

3)前两个>10个字的短语,我们拿出来在百度搜索下,计算百度搜索结果中,完整出现该短语的次数。

 

若一个文章被其他网站大量转载,那么随便提取该文章中一个短语,都能在百度搜索出完全重复的内容:

如果我们连续搜索两个短语,在百度搜索中,完全重复的结果很少,则可以一定程度代表该内容被其他站点大量转载的概率比较小,原创度较高

原创

以上3个步骤,编写一个脚本来执行:

左列是文章ID,右列是两个短语,在百度搜索结果中完整出现的次数。次数越大,重复度越高,具体数值达到多少,自己定义。比如本渣一般将>=30%定位重复度比较高的,即搜索2个短语,20个搜索结果中,完整出现该短语的结果有>=6个

  1. #coding:utf-8  
  2.   
  3. import requests,re,time,sys,json,datetime  
  4. import multiprocessing  
  5. import MySQLdb as mdb  
  6.   
  7. reload(sys)  
  8. sys.setdefaultencoding('utf-8')  
  9.   
  10. current_date = time.strftime('%Y-%m-%d',time.localtime(time.time()))  
  11.   
  12. def search(req,html):  
  13.     text = re.search(req,html)  
  14.     if text:  
  15.         data = text.group(1)  
  16.     else:  
  17.         data = 'no'  
  18.     return data  
  19.   
  20. def date(timeStamp):  
  21.     timeArray = time.localtime(timeStamp)  
  22.     otherStyleTime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray)  
  23.     return otherStyleTime  
  24.       
  25. def getHTml(url):  
  26.   
  27.     host = search('^([^/]*?)/',re.sub(r'(https|http)://','',url))  
  28.   
  29.     headers = {  
  30.         "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",  
  31.         "Accept-Encoding":"gzip, deflate, sdch",  
  32.         "Accept-Language":"zh-CN,zh;q=0.8,en;q=0.6",  
  33.         "Cache-Control":"no-cache",  
  34.         "Connection":"keep-alive",  
  35.         #"Cookie":"",  
  36.         "Host":host,  
  37.         "Pragma":"no-cache",  
  38.         "Upgrade-Insecure-Requests":"1",  
  39.         "User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36",  
  40.     }  
  41.   
  42.   # 代理服务器  
  43.     proxyHost = "proxy.abuyun.com"  
  44.     proxyPort = "9010"  
  45.   
  46.     # 代理隧道验证信息  
  47.     proxyUser = "XXXX"  
  48.     proxyPass = "XXXX"  
  49.   
  50.     proxyMeta = "http://%(user)s:%(pass)s@%(host)s:%(port)s" % {  
  51.       "host" : proxyHost,  
  52.       "port" : proxyPort,  
  53.       "user" : proxyUser,  
  54.       "pass" : proxyPass,  
  55.     }  
  56.   
  57.     proxies = {  
  58.         "http"  : proxyMeta,  
  59.         "https" : proxyMeta,  
  60.     }  
  61.   
  62.     html = requests.get(url,headers=headers,timeout=30)  
  63.     # html = requests.get(url,headers=headers,timeout=30,proxies=proxies)  
  64.     code = html.encoding  
  65.     return html.content  
  66.   
  67.   
  68. def getContent(word):  
  69.   
  70.     pcurl = 'http://www.baidu.com/s?q=&tn=json&ct=2097152&si=&ie=utf-8&cl=3&wd=%s&rn=10' % word  
  71.     # print '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ start crawl %s @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@' % pcurl  
  72.     html = getHTml(pcurl)  
  73.   
  74.     a = 0  
  75.     html_dict = json.loads(html)  
  76.     for tag in html_dict['feed']['entry']:  
  77.         if tag.has_key('title'):  
  78.             title = tag['title']  
  79.             url = tag['url']  
  80.             rank = tag['pn']  
  81.             time = date(tag['time'])  
  82.             abs = tag['abs']  
  83.               
  84.             if word in abs:  
  85.                 a += 1  
  86.     return a  
  87.   
  88.   
  89. con = mdb.connect('127.0.0.1','root','','wddis',charset='utf8',unix_socket='/tmp/mysql.sock')  
  90. cur = con.cursor()  
  91. with con:  
  92.     cur.execute("select aid,content from pre_portal_article_content limit 10")  
  93.     numrows = int(cur.rowcount)  
  94.     for i in range(numrows):  
  95.         row = cur.fetchone()  
  96.   
  97.         aid = row[0]  
  98.         content = row[1]  
  99.         content_format = re.sub('<[^>]*?>','',content)  
  100.           
  101.         a = 0  
  102.         for z in [ x for x in content_format.split(',') if len(x)>10 ][:2]:  
  103.             a += getContent(z)  
  104.         print "%s --> %s" % (aid,a)  
  105.           
  106.   
  107. # words = open(wordfile).readlines()  
  108. # pool = multiprocessing.Pool(processes=10)  
  109. for word in words:  
  110.     # word = word.strip()  
  111.     # pool.apply_async(getContent, (word,client ))  
  112. # pool.close()  
  113. # pool.join()  

推荐阅读

python怎么采集内容标题进行重写伪原创

内容采集是站长常常需要的工作,而为了进一步提升采集内容的SEO价值,往往需要对内容进行进一步处理,其中修改标题就是最重要的一项,如果一个个修改太累了,怎么通过python批量进程重写伪原创呢?...

为什么原创内容没有好的排名?

因为搜索排序他会受到多种维度,多种因素的影响,不光只是考核原创性,还有站点的综合质量,以及用户喜爱程度。...

原创内容被排名更好的网站复制转载该怎么办?

请通过以下方式举报:https://www.wenjuan.com/s/UZBZJv7gVT/ ,同时也可以在反馈中心进行反馈 相关SEO术语解释: K站: 网站优化中比较常见的一个名词,它所指的是在网站已经达到正常收录的状态下因为作弊或者其他原因,......