好友
阅读权限10
听众
最后登录1970-1-1
|
ihhz
发表于 2024-1-11 09:25
本帖最后由 ihhz 于 2024-3-6 09:24 编辑
小小辅助工具,提取135收费模板 用于微信公众号文章
需要打开编辑器的HTML代码模式粘贴进去~~~
程序下载链接: https://pan.baidu.com/s/1yUHr2pAlGFHV7kRRPFf9PA?pwd=52pj 提取码: 52pj 复制这段内容后打开百度网盘手机App,操作更方便哦
[Asm] 纯文本查看 复制代码 import re
import tkinter
from tkinter import messagebox
import pyperclip
import requests
def tiqu():
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.5735.289 Safari/537.36',
}
id = str_TextBox1.get()
response = requests.get('https://www.135editor.com/editor_styles/{}.html'.format(id), headers=headers)
com = re.compile('<div class="l-img">.*?</div>',re.S)
shou = com.findall(response.text)[0]
if shou:
pyperclip.copy(shou)
messagebox.showinfo('提示', '以复制到你的粘贴板,直接粘贴即可~')
else:
messagebox.showinfo('提示', '模板ID错误~无法获取数据~~')
win = tkinter.Tk() # 设定窗体变量
win.geometry('310x88+50+50') # 格式('宽x高+x+y')其中x、y为位置
win.title('135收费模板提取助手')
ihc1 = tkinter.Button(win, text='提取模板', font=('宋体', '9'),command=tiqu)
ihc1.place(x=202, y=7, width=88, height=29)
ihLabel1 = tkinter.Label(win, text='输入模板ID', font=('宋体', '9'))
ihLabel1.place(x=7, y=14, height=22)
str_TextBox1 = tkinter.StringVar() # 绑定变量
ihTextBox1 = tkinter.Entry(win, textvariable=str_TextBox1, font=('宋体', '9'))
ihTextBox1.place(x=79, y=7, width=101, height=29)
str_TextBox1.set('137387')
win.mainloop()
这个是秀米的模板处理方法,需要F12提取一下模板页面的代码
[Asm] 纯文本查看 复制代码
import re
import time
import pyperclip
htmls = ""
urls = ""
def getCopyTxet():
t = pyperclip.paste()
return t
def xiumi(html):
t1 = str('?x-oss-process=style/xmwebp')
str1 = str('background-image: url(//')
str2 = str('background-image: url(http://')
tt1 = 'background-image: url("//'
tt2 = 'background-image: url("http://'
html = re.sub(t1.replace('?', '\?'), '', html)
print('批量删除1')
time.sleep(.1)
html = re.sub(str1.replace('(', '\(').replace(')', '\)'), str2, html)
html = re.sub(tt1.replace('(', '\(').replace(')', '\)'), tt2, html)
time.sleep(.1)
print('批量删除2')
html = re.sub('xlink:href="//', 'src="http://', html)
html = re.sub('src="//img', 'src="http://img', html)
time.sleep(.1)
print('批量删除3')
html = re.sub('tn-comp-pin tn-comp-style', '', html)
print('批量删除3')
html = re.sub('tn-comp', '', html)
print('批量删除3')
html = re.sub('cell', '', html)
print('批量删除3')
html = re.sub('compAttr', '', html)
print('批量删除3')
html = re.sub('tn-', '', html)
print('批量删除3')
html = re.sub('<image', '<img', html)
time.sleep(.1)
print('批量删除3')
html = re.sub('</svg>', '', html)
time.sleep(.1)
print('批量删除4')
com1 = re.compile('<svg class=".*?>', re.S)
res1 = com1.findall(html)
res2 = list(res1)
ss = 0
while True:
try:
print('删除' + res2[ss])
html = re.sub(res2[ss], '', html)
ss = ss + 1
except:
break
time.sleep(.1)
return html
last_data = None
while True:
data = getCopyTxet()
if data != last_data:
ifs = 0
last_data = data
sdata1 = re.search('xiumi', data)
if sdata1 != None:
print("发现粘贴板是xiumi模板")
htmls = xiumi(data)
break
print("粘贴板有新内容:但是没有发现模板")
d= data.split()
print(d)
break
time.sleep(2)
pyperclip.copy(htmls)
#以保存到你的粘贴板以HTML下粘贴即可
|
免费评分
-
查看全部评分
|