ihhz 发表于 2024-1-11 09:25

分享小小辅助工具,提取135收费模板 用于微信公众号文章

本帖最后由 ihhz 于 2024-3-6 09:24 编辑

小小辅助工具,提取135收费模板 用于微信公众号文章
需要打开编辑器的HTML代码模式粘贴进去~~~


程序下载链接: https://pan.baidu.com/s/1yUHr2pAlGFHV7kRRPFf9PA?pwd=52pj 提取码: 52pj 复制这段内容后打开百度网盘手机App,操作更方便哦


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)
    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提取一下模板页面的代码




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(&quot;//'
    tt2 = 'background-image: url(&quot;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)
            html = re.sub(res2, '', 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下粘贴即可

庸世俗人罢勒 发表于 2024-1-11 16:54

风华 发表于 2024-1-11 15:48
有木有其他网站的方法

像96、135、365、小蚂蚁这些左侧有预览效果的都可以通过F12查代码<section data-id="xxxxxx">开头的直接复制代码,再在编辑器的html的模式中粘贴源码后退出html模式就可以用了。。而且内容可以在不同平台中编辑二创……{:301_998:}

ihhz 发表于 2024-3-6 09:22

风华 发表于 2024-1-11 21:38
对于米秀,壹伴这种预览的模版咋弄

这个是秀米的模板处理方法,需要F12提取一下模板页面的代码


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(&quot;//'
    tt2 = 'background-image: url(&quot;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)
            html = re.sub(res2, '', 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下粘贴即可

gada888 发表于 2024-1-11 11:01

这个好。支持

十点睡先生 发表于 2024-1-11 11:03

支持一下下

萌29199 发表于 2024-1-11 11:13

你这个厉害啊 ,正需要

踏平P城 发表于 2024-1-11 11:18

Win 10 系统实测无效

chen1990 发表于 2024-1-11 11:50

下载试试、感谢分享

饮食协会 发表于 2024-1-11 11:53

好像用不了

yi98130 发表于 2024-1-11 12:08

先点个赞收藏一下

yyzzy 发表于 2024-1-11 12:42

感谢大佬的分享

风华 发表于 2024-1-11 12:57

有木有其他编辑器的?
页: [1] 2 3 4 5 6 7
查看完整版本: 分享小小辅助工具,提取135收费模板 用于微信公众号文章