更新了企业微信的发送功能
This commit is contained in:
1 parent
0620d56e9a
commit
3c83bd6602
35 files changed
+2185
-1232
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
+17
-10
@@ -29,15 +29,22 @@ headers = {
|
||||
"Accept-Language": "zh-CN,zh;q=0.9"
|
||||
}
|
||||
|
||||
# def fetch_rss(url, headers):
|
||||
# try:
|
||||
# response = requests.get(url, headers=headers)
|
||||
# response.raise_for_status() # 检查请求是否成功
|
||||
# return response.content
|
||||
# except RequestException as e:
|
||||
# logger.error(f"请求 {url} 时发生错误: {e}")
|
||||
# return None # 返回None表示请求失败
|
||||
def fetch_rss(url, headers, timeout=20):
|
||||
doonsec_headers = {
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0",
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||
"Accept-Language": "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2",
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
"Upgrade-Insecure-Requests": "1",
|
||||
"Sec-Fetch-Dest": "document",
|
||||
"Sec-Fetch-Mode": "navigate",
|
||||
"Sec-Fetch-Site": "none",
|
||||
"Sec-Fetch-User": "?1",
|
||||
"Priority": "u=0, i",
|
||||
"Te": "trailers",
|
||||
"Connection": "keep-alive"
|
||||
}
|
||||
|
||||
def fetch_rss(url, headers, timeout=60):
|
||||
try:
|
||||
response = requests.get(url, headers=headers, timeout=timeout)
|
||||
response.raise_for_status() # 检查请求是否成功
|
||||
@@ -156,7 +163,7 @@ def huawei_main():
|
||||
# 洞见微信聚合爬虫
|
||||
def doonsec_main():
|
||||
url = "https://wechat.doonsec.com/bayes_rss.xml"
|
||||
rss_content = fetch_rss(url, headers)
|
||||
rss_content = fetch_rss(url, doonsec_headers)
|
||||
|
||||
if rss_content is None:
|
||||
logger.warning("无法获取洞见微信聚合RSS内容,跳过保存操作。")
|
||||
|
||||
Reference in new issue
Block a user