把网和谐易LOF和谐TER作为图床提高markdown写作舒适度

写在最前:我不会web,这种做法可能带来很多的bug,请自行衡量!!

此脚本高度实验性!!此脚本高度实验性!!此脚本高度实验性!!重要的事情说三遍!!(如果这个页面的图片挂了那说明这种方法应该不能稳定外链)

主要脚本:main.py

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import requests
import re
from PIL import Image,ImageGrab
import os
import pyperclip
def get_img_url(photo):
data = '''callCount=1\nscriptSessionId=${scriptSessionId}187\nhttpSessionId=\nc0-scriptName=ImageBean\nc0-methodName=genTokens\nc0-id=0\nc0-param0=string:png\nc0-param1=string:\nc0-param2=string:\nc0-param3=string:\nc0-param4=string:\nbatchId=643779'''
cookies_raw = r'''此处为你的cookies'''
headers = {'content-type': 'text/plain','User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36','Referer':'http://www.lofter.com/','Accept-Language':'zh-CN,zh;q=0.8'}
cookies={}
for line in cookies_raw.split(';'):
name,value=line.strip().split('=',1)
cookies[name]=value
token_raw = requests.post('http://www.lofter.com/dwr/call/plaincall/ImageBean.genTokens.dwr', data=data, headers=headers, cookies = cookies).text
token={}
for line in token_raw.split(';'):
if "bucketName" in line:
expr = re.compile(r"\"(.*?)\"")
token["bucketName"] = expr.search(line).group().strip("\"").encode("utf-8")
if "objectName" in line:
expr = re.compile(r"\"(.*?)\"")
token["objectName"] = expr.search(line).group().strip("\"").encode("utf-8")
if "uploadToken" in line:
expr = re.compile(r"\"(.*?)\"")
token["uploadToken"] = expr.search(line).group().strip("\"").encode("utf-8")
photo_head = {'content-type': 'image/jpeg','User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36','Accept-Language':'zh-CN,zh;q=0.8','x-nos-token':token['uploadToken']}
token_raw = requests.post('http://223.252.216.48/'+token['bucketName']+'/'+token['objectName']+'?version=1.0&offset=0&complete=true', data=photo, headers=photo_head).text
return '![](http://'+token['bucketName']+'.nosdn.127.net/'+token['objectName']+')'
filename = r"D:/grab_grabclipboard.png"
im = ImageGrab.grabclipboard()
if isinstance(im, Image.Image):
im.save(filename)
ret = get_img_url(open(r'D:\grab_grabclipboard.png','rb').read())
print ret
pyperclip.copy(ret)
else:
print "clipboard no img!"


然后就是用热键快速调用脚本,关于这点,我用c不知道该怎么写,确实挺尴尬的,就用国内的易语言完成一下吧。。。

代码界面:

易语言文件(源码加程序打包zip)base64加密:

1
UEsDBBQAAAgIAOuLZkoJErMicQQAAP4KAAAIAAAAbG9hZGVyLmWdVltPG1cQPsdeDDaxQppCAw0SVEmlCjXy2l5feksXX5q8VIhGSaUiuSjYIo4LFiYVSK2KVEUqb03bH9Bq2wQiIeLamHILiMQpBWMQl5BSHiL6ECm0apTeXtK4M7vrsFk7Cc5In3fn7JmZb+acGdn19oljnobGtyoje8p753WGygjRjA8tXBSS82PJtAZVFQihRBKG6MhrZOfCyLYSdA/87ESQ3z9jZ6qBAP36yuhlIZkGfhRVFQjRKOK8W0CMnUohvFGQ+4Hes71AjplKrWx9O7s4kEwzqKpAiFa2uWU6u1Sq2XmMEpEXbWy4KJDP0kc0GqiFHtZ81/5KDMYvTa5XgbKyHkst3sWV0T/XVhKDQ//ObEUv41eM9IOYF9UxhFbg2wJgTnL7mMBmGXHAadU3Rqk8qWo6sn1yIJmsjRL5fBVyGqsAwyMsord/7Gel1xrAPkCX/FRKQTllD7BEfvb09JBMJiM+ZcnQR3xT+94DmJkZv1fj6uwI1b3TeirQWXc8X1C8bolb1d1wn7RTqeWtZFqLr3mwnc2nX6TPvczk85ZfSoHe4T9KtWXwfkPUCSmSE8ZkDYrEB+R3hjjh93RHW6jN2GJyBswWq8nBOjiWbbE4bQFbc3PAYbWetPstZs7IGU3Gha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vI1YyccLJR0ZEPo8VDwTzacw6F9w/vltjVp6P8SAWT0LpeWHLXIrzZGcTFXArZ3gKluA8tUfEBGYRt04787EEF+mRK/pr4dy4xRVxYa2kW5n+c0/QK3R5JOFtvK6ujv3KNLC/oWSZcxn2JuB0co5us1V4Z6U/BvZAL3wVaz/0YK8TdsFO5Dux7sA+0fP2dy5Z9he3nOxLEIAfMKAXDNChH2LQh9b6IQoKWo6BChqOfoPJOPHNxQluVraKNx0H2rPk92DRIY6chppELnyXcRYK/b1RXSLfjiUOITbvEM5f1LtW/UsKHl79QPo+gE1MpxulNAhDAuUNXHEQBkFZIutm/iyWLfeq3Kd2oEh3oVQfWo2CD+WGYJR51YdvUfTHYGDXiuQ23dfXdv+qPhlyqasCZ785fN/YroZEaGAbvkAG4DNogzQHmV8x1Iqj3qY+8ovkuJc3jH13dwOzaeAcX4Iv4meEfRpRaxQ9HkUfYsiFmK1bmH/A9j6IHi3dGYB6tqt34ihpxnE8uCiWdseT9m5ve3vnzjv27hWdK/z/Nv8vUEsBAj8AFAAACAgA64tmSgkSsyJxBAAA/goAAAgAJAAAAAAAAAAgAAAAAAAAAGxvYWRlci5lCgAgAAAAAAABABgArIw1alyW0gGsjDVqXJbSAZvO2epbltIBUEsBAj8AFAAACAgA2ItmSi8efWiXCwAAACIAAAoAJAAAAAAAAAAgAAAAlwQAAGxvYWRlci5leGUKACAAAAAAAAEAGAAt85JVXJbSAQNikVVcltIBU/OeVFyW0gFQSwUGAAAAAAIAAgC2AAAAVhAAAAAA


使用方法

loader.exe和main.py放在一个文件夹内,启动loader.exe不要关闭,截图后(比如用QQ截图)在你想粘贴的位置按Ctrl+Shift+V即可快速粘贴图片外链。