Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
wrnxr233 authored Aug 21, 2021
1 parent 404e2cc commit eeb8eba
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions 百度推送链接.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import requests
import json

'''
作者:www.wrnxr.cc
'''

print('欢迎访问www.wrnxr.cc,更多资源等着您')

url='http://data.zz.baidu.com/urls?'
headers={'Content-Type':'text/plain'}
u=str(input(r'请输入您的站点地址,不要带http(s):'))
key=(input('请输入您的准入秘钥:'))
playload={'site':(u),'token':(key)}
with open("url.txt", "rb") as f:
result=requests.post(url,data=f,params=playload,headers=headers)
jr=json.loads(result.text)
if 'error' in jr:
er=jr['error']
msg=jr['message']
if 'token is not valid' in msg:
msg=('准入秘钥错误,请检查后重试')
elif 'empty content' in msg:
msg=('需要提交的链接为空,请检查url.txt后重试')
elif 'site init fail' in msg:
msg=('站点初始化失败,请检查站点地址是否正确')
print('错误代码:',er,
'\n返回信息:',msg)
input('按enter退出')
else:
rm=jr['remain']
su=jr['success']

print ('提交成功',su,'条链接\n'
'剩余',rm,'条可提交')
input('按enter退出')

0 comments on commit eeb8eba

Please sign in to comment.