• 网站导航

怎么提高网站权重(怎么提高网站的网速)

更新时间:2021-09-22 18:14:03 来源:  网络
近期可能很多人都在关注怎么提高网站权重相关的内容,今日小编也是在网上找了很多关于 怎么提高网站权重 相关信息并整理如下,希望对大家有所帮助:


怎么提高网站权重(怎么提高网站的网速)

做网站的人一般都很关注网站的收录量,而收录量就需要蜘蛛去爬取,而爬取则需要去提交。
而百度提供了api提交的方法。
用python进行提交的话,我选择的是post提交。

POST /urls?site=“自己网站的token” # 这里是site后面那一段带网站的,[color=#f95d5d][font=tahoma, PingFangSC, "]site[/font][/color][color=#666666][font=tahoma, PingFangSC, "]=[/font][/color][color=#666666][font=tahoma, PingFangSC, "]https://zjzdmc.top[/font][/color][color=#666666][font=tahoma, PingFangSC, "]&[/font][/color][color=#f95d5d][font=tahoma, PingFangSC, "]token[/font][/color][color=#666666][font=tahoma, PingFangSC, "]=xxxxxxxx,并非是整个[/font][/color][color=#666666][font=tahoma, PingFangSC, "]接口调用地址。[/font][/color]User-Agent: curl/7.12.1Host: data.zz.baidu.comContent-Type: text/plainContent-Length: 83

这个第一行的token请换成自己的。


私信小编01即可获取大量Python学习资源


http://www.example.com/1.htmlhttp://www.example.com/2.html

这个是提交示例,也就是说一个一行。

{ "remain":99998, "success":2, "not_same_site":[], "not_valid":[]}

这个是返回信息,那么如何去写就一目了然了。


怎么提高网站权重(怎么提高网站的网速)

Python源码:

import requestsimport reimport timeheaders = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36,', 'Host': 'data.zz.baidu.com', 'Content-Length':'83'}print("*"*30)print('links.txt示例:nhttps://xxxxx.htmlnhttps://xxxxx.htmlnhttps://xxxxx.htmlnhttps://xxxxx.html')print("*"*30)print('api示例:nhttp://data.zz.baidu.com/urls?site=xxxxxxxxxxx')push_num = 1while push_num < 9999: if push_num == 1: answer = input("请问你是否已经将链接填入links.txt,api填入api.txt中呢,如果是则回答1n") if answer == '1': try: with open('links.txt', 'r') as links: links = links.read() except FileNotFoundError: print("links.txt文件不存在") try: with open('api.txt', 'r') as api: api = api.read() except FileNotFoundError: print("links.txt文件不存在") def thinklink(links, api): if links == '': print("links.txt文件为空") else: if api == '': print('api.txt为空') else: try: html_result = requests.post(api, headers=headers, timeout=5, data=links).text return html_result except: return print("失败") push_result = thinklink(links, api) print('提交完成:'+push_result) surplus_push_num = re.findall('"remain":(.*),"', push_result) surplus_push_num = surplus_push_num.pop() print('剩余' + surplus_push_num + '次提交机会') else: print("请将内容填充!5秒钟后自动关闭") time.sleep(5) break print('*'*30) new_answer = input("是否还需要提交,如果是的话请先去更改一下相应文件,如果是请输入1,如果否请输入0n") if new_answer == '0': print("提交结束,5秒钟后自动关闭") time.sleep(5) break push_num += 1 print("现在开始第"+str(push_num)+'次提交')


怎么提高网站权重(怎么提高网站的网速)

需要在python文件新建两个txt文件,分别放token和链接。
然后其他人就可以直接双击打开python文件进行提交了。如果有什么疑问可以直接问。

以上就是关于怎么提高网站权重 相关问题啦,如需了解更多关于怎么提高网站权重问题,关注我们的下次更新哦