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)
访问自己的网站
写上python 文件地址即可,记得验证一下