〖微博谈搬运2021/01/02〗捍卫自由 保卫宪法 守护美利坚
搬运自博谈网 原地址:https://botanwang.com/articles/202101/〖微博谈〗新年好.html 微博谈部分条目有较高娱乐性与魔幻现实主义色彩,故而加上“翻车新闻”标签。 上一 …
因个人原因,暂且停止搬运。
我这里提供一个Python脚本来搬运,欢迎使用。
\# -\*- coding: utf-8 -\*-
from os import sep
from re import findall
from sys import argv, exit
from time import sleep
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtWidgets import QApplication
from requests import get
class Ui\_pincong(object):
def setupUi(self, pincong):
pincong.setObjectName("pincong")
pincong.resize(616, 737)
self.textEdit = QtWidgets.QTextEdit(pincong)
self.textEdit.setGeometry(QtCore.QRect(70, 10, 521, 71))
self.textEdit.setAcceptRichText(False)
self.textEdit.setObjectName("textEdit")
self.textEdit\_2 = QtWidgets.QTextEdit(pincong)
self.textEdit\_2.setGeometry(QtCore.QRect(70, 90, 521, 31))
self.textEdit\_2.setAcceptRichText(False)
self.textEdit\_2.setObjectName("textEdit\_2")
self.textEdit\_3 = QtWidgets.QTextEdit(pincong)
self.textEdit\_3.setGeometry(QtCore.QRect(70, 130, 521, 31))
self.textEdit\_3.setAcceptRichText(False)
self.textEdit\_3.setObjectName("textEdit\_3")
self.textEdit\_4 = QtWidgets.QTextEdit(pincong)
self.textEdit\_4.setGeometry(QtCore.QRect(70, 170, 521, 81))
self.textEdit\_4.setAcceptRichText(False)
self.textEdit\_4.setObjectName("textEdit\_4")
self.pushButton = QtWidgets.QPushButton(pincong)
self.pushButton.setGeometry(QtCore.QRect(160, 490, 71, 31))
self.pushButton.setObjectName("pushButton")
self.pushButton\_2 = QtWidgets.QPushButton(pincong)
self.pushButton\_2.setGeometry(QtCore.QRect(310, 490, 71, 31))
self.pushButton\_2.setObjectName("pushButton\_2")
self.label = QtWidgets.QLabel(pincong)
self.label.setGeometry(QtCore.QRect(10, 20, 54, 12))
self.label.setObjectName("label")
self.label\_2 = QtWidgets.QLabel(pincong)
self.label\_2.setGeometry(QtCore.QRect(10, 100, 54, 12))
self.label\_2.setObjectName("label\_2")
self.label\_3 = QtWidgets.QLabel(pincong)
self.label\_3.setGeometry(QtCore.QRect(10, 140, 54, 12))
self.label\_3.setObjectName("label\_3")
self.textEdit\_5 = QtWidgets.QTextEdit(pincong)
self.textEdit\_5.setGeometry(QtCore.QRect(70, 270, 521, 81))
self.textEdit\_5.setAcceptRichText(False)
self.textEdit\_5.setObjectName("textEdit\_5")
self.label\_4 = QtWidgets.QLabel(pincong)
self.label\_4.setGeometry(QtCore.QRect(10, 210, 54, 12))
self.label\_4.setObjectName("label\_4")
self.label\_5 = QtWidgets.QLabel(pincong)
self.label\_5.setGeometry(QtCore.QRect(10, 310, 54, 12))
self.label\_5.setObjectName("label\_5")
self.label\_6 = QtWidgets.QLabel(pincong)
self.label\_6.setGeometry(QtCore.QRect(10, 440, 54, 12))
self.label\_6.setObjectName("label\_6")
self.textEdit\_6 = QtWidgets.QTextEdit(pincong)
self.textEdit\_6.setGeometry(QtCore.QRect(70, 430, 521, 31))
self.textEdit\_6.setAcceptRichText(False)
self.textEdit\_6.setObjectName("textEdit\_6")
self.textEdit\_7 = QtWidgets.QTextEdit(pincong)
self.textEdit\_7.setGeometry(QtCore.QRect(70, 380, 521, 31))
self.textEdit\_7.setAcceptRichText(False)
self.textEdit\_7.setObjectName("textEdit\_7")
self.label\_7 = QtWidgets.QLabel(pincong)
self.label\_7.setGeometry(QtCore.QRect(10, 390, 54, 12))
self.label\_7.setObjectName("label\_7")
self.retranslateUi(pincong)
self.pushButton.clicked.connect(self.pa)
self.pushButton\_2.clicked.connect(self.change)
self.textEdit\_8 = QtWidgets.QTextEdit(pincong)
self.textEdit\_8.setGeometry(QtCore.QRect(70, 540, 521, 71))
self.textEdit\_8.setAcceptRichText(False)
self.textEdit\_8.setObjectName("textEdit\_8")
self.textEdit\_9 = QtWidgets.QTextEdit(pincong)
self.textEdit\_9.setGeometry(QtCore.QRect(70, 630, 521, 71))
self.textEdit\_9.setAcceptRichText(False)
self.textEdit\_9.setObjectName("textEdit\_9")
def retranslateUi(self, pincong):
\_translate = QtCore.QCoreApplication.translate
pincong.setWindowTitle(\_translate("pincong", "搬运"))
self.textEdit\_2.setText(\_translate("pincong", "http://127.0.0.1:1080"))
self.pushButton.setText(\_translate("pincong", "爬"))
self.pushButton\_2.setText(\_translate("pincong", "图片转换"))
self.label.setText(\_translate("pincong", "源码"))
self.label\_2.setText(\_translate("pincong", "代理"))
self.label\_3.setText(\_translate("pincong", "标题"))
self.label\_4.setText(\_translate("pincong", "正文"))
self.label\_5.setText(\_translate("pincong", "图片"))
self.label\_6.setText(\_translate("pincong", "工作路径"))
self.textEdit\_6.setText(\_translate("pincong", r"C:\\Users\\Administrator\\Desktop\\1"))
self.label\_7.setText(\_translate("pincong", "上一期"))
def get\_content(self, url):
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.40 Safari/537.36'}
if self.textEdit\_2.toPlainText() is None:
return get(url=url, headers=headers).content
else:
proxies = {
"http": self.textEdit\_2.toPlainText(),
"https": self.textEdit\_2.toPlainText()
}
return get(url=url, proxies=proxies, headers=headers).content
def pa(self):
source = self.textEdit.toPlainText()
date = findall("\\d\*(?=-bt)", source)\[0\]
date2 = date\[:4\] + "/" + str(int(date\[4:6\])) + "/" + str(int(date\[6:8\]))
title = findall("(?<=〖微博谈〗).\*?(?= \\| 博谈网)", source)\[0\]
self.textEdit\_3.setText("〖微博谈搬运" + date2 + "〗" + title)
if len(self.textEdit\_7.toPlainText()) > 13:
self.textEdit\_7.setText(self.textEdit\_7.toPlainText().split("https://pincong.rocks/article/")\[1\])
if " " in title:
title2 = title.split(" ")\[0\] + "%7C" + title.split(" ")\[1\]
body = "搬运自博谈网\\n原地址:\[url=https://botanwang.com/articles/" + date\[:6\] + "/〖微博谈〗" + title2 + \\
".html\]https://botanwang.com/articles/" + date\[:6\] + "/〖微博谈〗" + title + ".html\[/url\]\\n" + \\
"微博谈部分条目有较高娱乐性与魔幻现实主义色彩,故而加上“翻车新闻”标签。\\n\\n上一期:\[url=https://pincong.rocks/article/" + \\<br /> self.textEdit\_7.toPlainText() + "\]https://pincong.rocks/article/" + self.textEdit\_7.toPlainText() + "\[/url\]\\n\\n"
else:
body = "搬运自博谈网\\n原地址:\[url=https://botanwang.com/articles/" + date\[:6\] + "/〖微博谈〗" + title + \\
".html\]https://botanwang.com/articles/" + date\[:6\] + "/〖微博谈〗" + title + ".html\[/url\]\\n" + \\
"微博谈部分条目有较高娱乐性与魔幻现实主义色彩,故而加上“翻车新闻”标签。\\n\\n上一期:\[url=https://pincong.rocks/article/" + \\<br /> self.textEdit\_7.toPlainText() + "\]https://pincong.rocks/article/" + self.textEdit\_7.toPlainText() + "\[/url\]\\n\\n"
self.textEdit\_4.setText(body)
a = b = ""
for i in range(1, 6):
a += findall(f"<p>{str(i)}\\..\*?(?=</p>)", source)\[0\]\[3:\] + "\\n\\n"
self.textEdit\_8.setText(a)
for i in range(6, 11):
b += findall(f"<p>{str(i)}\\..\*?(?=</p>)", source)\[0\]\[3:\] + "\\n\\n"
self.textEdit\_9.setText(b)
a = 1
for pic in findall("/sites/default/files/images.\*.jpg", source):
QApplication.processEvents()
pic\_dir = self.textEdit\_6.toPlainText() + sep + f"{a:0>2d}.jpg"
open(pic\_dir, 'wb').write(self.get\_content("https://botanwang.com/" + pic))
a += 1
sleep(0.5)
def change(self):
text2 = ""
source = self.textEdit\_5.toPlainText().split("\\n")
for text in source:
if len(text) != 0:
text2 += f"\[img\]https://pincong.rocks/publish/article/{text\[6:106\]}\[/img\]\\n"
self.textEdit\_5.setText(text2)
if \_\_name\_\_ == "\_\_main\_\_":
app = QtWidgets.QApplication(argv)
widget = QtWidgets.QWidget()
ui = Ui\_pincong()
ui.setupUi(widget)
widget.show()
exit(app.exec\_())
上传到图床的脚本
from base64 import b64encode
from pathlib import Path
from re import findall
from time import sleep
from pyperclip import copy
from requests import post
from requests.packages.urllib3 import disable\_warnings
from requests.packages.urllib3.exceptions import InsecureRequestWarning
disable\_warnings(InsecureRequestWarning)
url = 'https://api.imgur.com/3/image'
proxies = {
"http": 'http://127.0.0.1:1080',
"https": 'http://127.0.0.1:1080'
}
headers = {'Authorization': 'Client-ID 98cd21cdfc58130'}
def upload(url1):
return post(url, headers=headers, data={'image': b64encode(open(url1, 'rb').read()), 'type': 'base64'},
proxies=None, verify=False).text
PicDir = Path(r'C:\\Users\\Administrator\\Desktop\\1')
a = \[\]
for sub in \['jpeg', 'png', 'gif', 'apng', 'jpg', 'tif', 'bmp'\]:
for file in PicDir.glob('\*\*/\*.' + sub):
a.append(file)
# a.append(a\[1\])
# del a\[1\]
b = ''
for img in a:
print(img)
res = 'https://' + repr(findall('i.imgur.com.\*?(?="})', upload(img))).replace('\\\\', '')\[2:-2\]
while res == "https://":
res = 'https://' + repr(findall('i.imgur.com.\*?(?="})', upload(img))).replace('\\\\', '')\[2:-2\]
else:
print(res)
b += '\[img\]' + res + '\[/img\]\\n'
sleep(0.23)
print('\\n' + b)
copy(b)
我喜歡搬運反共著作,本人有長期搬運反共著作的經驗,高勞動量的反共搬運勞動可以讓我負責。
啊,連你也要走了嗎 _(:з」∠)_
辛苦長期以來搬運~
我來研究看看怎麼搬 _(:з」∠)_
玫瑰花的葬禮** 评论于 2021-01-02
>> 啊,連你也要走了嗎 _(:з」∠)_辛苦長期以來搬運~我來研究看看怎麼搬 _(:з」∠)_
如果你会Python的话,那是很轻松的
感谢一直以来的付出
Cyberspace** 评论于 2021-01-02
>> 如果你会Python的话,那是很轻松的
問就是不會😂 _(:з」∠)_
我來估狗研究一下
搬运自博谈网 原地址:https://botanwang.com/articles/202101/〖微博谈〗新年好.html 微博谈部分条目有较高娱乐性与魔幻现实主义色彩,故而加上“翻车新闻”标签。 上一 …
搬运自博谈网 原地址:https://botanwang.com/articles/202012/〖微博谈〗现在是需要魄力的时候.html 微博谈部分条目有较高娱乐性与魔幻现实主义色彩,故而加上“翻车新闻”标签。 上一 …
搬运自博谈网 原地址:https://botanwang.com/articles/202012/〖微博谈〗开局一只讨饭碗 终局一根上吊绳.html 微博谈部分条目有较高娱乐性与魔幻现实主义色彩,故而加上“翻车新闻”标签。 上一 …
搬运自博谈网 原地址:https://botanwang.com/articles/202012/〖微博谈〗感谢川普总统.html 微博谈部分条目有较高娱乐性与魔幻现实主义色彩,故而加上“翻车新闻”标签。 上一 …
搬运自博谈网 原地址:https://botanwang.com/articles/202012/〖微博谈〗中共要不胡说八道就不叫中共了.html 微博谈部分条目有较高娱乐性与魔幻现实主义色彩,故而加上“翻车新闻”标签。 上一 …