From ef2ac8777b178baa2ba5993aed82926528f58fc0 Mon Sep 17 00:00:00 2001 From: Ching Date: Tue, 8 Mar 2022 11:44:54 +0800 Subject: [PATCH] =?UTF-8?q?feat(main):=20=E4=BF=AE=E6=94=B9=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=20html=20=E6=A0=87=E7=AD=BE=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改替换 html 标签逻辑 Signed-off-by: Ching --- main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index e4bae04..4f4b6c5 100644 --- a/main.py +++ b/main.py @@ -4,6 +4,7 @@ from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.chrome.options import Options import time +import re def post_fanfou(webdrive_, fanfou_status, images=None): @@ -59,7 +60,8 @@ def run(instance, access_token, fanfou_account, fanfou_password): posted_ids = [x.strip() for x in posted_ids] print(posted_ids) if str(min_id) not in posted_ids: - content = status['content'].replace('

', '').replace('

', '').replace('
', '\n') + content = status['content'].replace('
', '\n') + content = re.sub('<.*?>', '', content) post_fanfou(chrome, content, None) # write to file with open('last_id.txt', 'a') as f: