新建一个py文件
import requests
from sys import argv
uploadUrl = 'https://upload.cnblogs.com/imageuploader/processupload?host=www.cnblogs.com'
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
"cookie": "" # 这里的内容要自己填写
}
for i in argv[1:]:
format = i[i.rfind(".") + 1:]
file = [
("", ("fileName", open(i, "rb"), "image/" + format))
]
response = requests.post(uploadUrl, headers=headers, files=file)
text = response.text
imgUrl = text[text.find("https"):-2]
print(imgUrl)
获得Cookie
访问自己的网站
Typora设置
写上python 文件地址即可,记得验证一下
标签:format,text,博客园,Typora,537.36,headers,图床,file From: https://www.cnblogs.com/cyfuture/p/16614736.html