上线百度搜索监测
This commit is contained in:
parent
ad0403554e
commit
8ec55edd2a
46
Core.py
46
Core.py
@ -19,6 +19,7 @@ from spider.freebuf import freebuf_main
|
||||
from spider.xianzhi import xianzhi_main
|
||||
from spider.sougou_wx import sougou_wx_main
|
||||
from spider.github import github_main, load_github_config
|
||||
from spider.baidu import baidu_main
|
||||
from GotoSend.M_4hou import Src_4hou
|
||||
from GotoSend.anquanke import Src_anquanke
|
||||
from GotoSend.doonsec import Src_doonsec
|
||||
@ -28,6 +29,7 @@ from GotoSend.qianxin import Src_qianxin
|
||||
from GotoSend.seebug import Src_seebug
|
||||
from GotoSend.sougou_wx import Src_sougou_wx
|
||||
from GotoSend.github import Src_github
|
||||
from GotoSend.baidu import Src_baidu
|
||||
from config.check_config import get_core_config, get_debug_config, get_kewords_config
|
||||
from loguru import logger
|
||||
|
||||
@ -86,7 +88,7 @@ def check_avaliable(info_long, info_short, title, webhook_url, timestamp, sign):
|
||||
logger.info(f"{title}数据为空,跳过执行。")
|
||||
|
||||
def send_job_RSS(time_1):
|
||||
Sogou_WX, Doonsec_switch, Doonsec = get_kewords_config()
|
||||
Doonsec_switch, Doonsec = get_kewords_config('Doonsec')
|
||||
# print(f"当前配置信息:Doonsec_switch:{Doonsec_switch}")
|
||||
# 爬取数据
|
||||
seebug_main()
|
||||
@ -127,7 +129,7 @@ def send_job_RSS(time_1):
|
||||
check_avaliable(result_seebug_long, result_seebug_short, "Seebug社区资讯", webhook_url, timestamp, sign)
|
||||
|
||||
def send_job_SX():
|
||||
Sogou_WX, Doonsec_switch, Doonsec = get_kewords_config()
|
||||
Sogou_WX = get_kewords_config('Sogou_WX')
|
||||
sougou_wx_main(Sogou_WX)
|
||||
result_sx_long = Src_sougou_wx(False)
|
||||
result_sx_short = Src_sougou_wx(True)
|
||||
@ -146,6 +148,14 @@ def send_job_github(time_1):
|
||||
check_avaliable(result_github_3_long, result_github_3_short, "Github项目监控-大佬工具", webhook_url, timestamp, sign)
|
||||
check_avaliable(result_github_4_long, result_github_4_short, "Github项目监控-项目版本发布监测", webhook_url, timestamp, sign)
|
||||
|
||||
def send_job_baidu():
|
||||
Baidu = get_kewords_config('Baidu')
|
||||
baidu_main(Baidu)
|
||||
result_baidu_long = Src_baidu(False)
|
||||
result_baidu_short = Src_baidu(True)
|
||||
webhook_url, timestamp, sign = gen_sign()
|
||||
check_avaliable(result_baidu_long, result_baidu_short, "百度搜索关键词相关内容", webhook_url, timestamp, sign)
|
||||
|
||||
# 探测rss源状态
|
||||
def check_rss_status(url):
|
||||
try:
|
||||
@ -190,6 +200,8 @@ def main_job(e_hour):
|
||||
send_job_SX()
|
||||
if 2 in choice:
|
||||
send_job_github(e_hour)
|
||||
if 3 in choice:
|
||||
send_job_baidu()
|
||||
logger.info("单次运行结束,等待下一次运行...")
|
||||
|
||||
def main_loop(time_choice):
|
||||
@ -227,25 +239,39 @@ def send_first_message():
|
||||
start_info += "时间配置:每隔" + str(e_hour) + "小时执行一次推送\n"
|
||||
elif time_choice == 0:
|
||||
start_info += "时间配置:每天固定时间点执行推送\n"
|
||||
start_info += "开启状态:\n"
|
||||
|
||||
if 0 in choice:
|
||||
start_info += "RSS源监测\n"
|
||||
if 1 in choice:
|
||||
start_info += "搜狗-微信公众号监测\n"
|
||||
if 2 in choice:
|
||||
start_info += "Github项目监测\n"
|
||||
if 3 in choice:
|
||||
start_info += "百度搜索关键词内容监测\n"
|
||||
|
||||
if fs_activate == "True":
|
||||
result = SendToFeishu(start_info, "程序信息", webhook_url_once, timestamp_once, sign_once)
|
||||
logger.info(result)
|
||||
send_result = SendToFeishu(f"[点此访问]({url_web})网站以查看全部文章。", "首次运行提醒", webhook_url_once, timestamp_once, sign_once)
|
||||
logger.info(send_result)
|
||||
if wx_activate == "True":
|
||||
result = SendToWX(start_info, "程序信息")
|
||||
logger.info(result)
|
||||
send_result = SendToWX(f"[点此访问]({url_web})网站以查看全部文章。", "首次运行提醒")
|
||||
logger.info(send_result)
|
||||
|
||||
if 0 in choice:
|
||||
if fs_activate == "True":
|
||||
result = SendToFeishu(start_info, "程序信息", webhook_url_once, timestamp_once, sign_once)
|
||||
logger.info(result)
|
||||
result = SendToFeishu(rss_info, "RSS源状态", webhook_url_once, timestamp_once, sign_once)
|
||||
# logger.info(rss_info)
|
||||
logger.info(result)
|
||||
send_result = SendToFeishu(f"[点此访问]({url_web})网站以查看全部文章。", "首次运行提醒", webhook_url_once, timestamp_once, sign_once)
|
||||
logger.info(send_result)
|
||||
else:
|
||||
pass
|
||||
if wx_activate == "True":
|
||||
result = SendToWX(start_info, "程序信息")
|
||||
logger.info(result)
|
||||
result = SendToWX(rss_info, "RSS源状态")
|
||||
# logger.info(rss_info)
|
||||
logger.info(result)
|
||||
send_result = SendToWX(f"[点此访问]({url_web})网站以查看全部文章。", "首次运行提醒")
|
||||
logger.info(send_result)
|
||||
else:
|
||||
pass
|
||||
|
||||
|
177
Dev_test.py
177
Dev_test.py
@ -1,50 +1,135 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@Author: MasonLiu
|
||||
@Description: 测试用脚本,无需关注。
|
||||
"""
|
||||
# # -*- coding: utf-8 -*-
|
||||
# """
|
||||
# @Author: MasonLiu
|
||||
# @Description: 测试用脚本,无需关注。
|
||||
# """
|
||||
|
||||
import schedule
|
||||
import os
|
||||
import signal
|
||||
import sys
|
||||
import time
|
||||
import yaml
|
||||
import requests
|
||||
from datetime import datetime, timedelta
|
||||
from SendCore.FeishuSendBot import SendToFeishu, gen_sign
|
||||
from SendCore.QiweiSendBot import SendToWX
|
||||
from spider.common import run, seebug_main, M_4hou_main, anquanke_main, sec_wiki_main, huawei_main, doonsec_main, qianxin_main
|
||||
from spider.freebuf import freebuf_main
|
||||
from spider.xianzhi import xianzhi_main
|
||||
from spider.sougou_wx import sougou_wx_main
|
||||
from spider.github import github_main, load_github_config
|
||||
from GotoSend.M_4hou import Src_4hou
|
||||
from GotoSend.anquanke import Src_anquanke
|
||||
from GotoSend.doonsec import Src_doonsec
|
||||
from GotoSend.xianzhi import Src_xianzhi
|
||||
from GotoSend.freebuf import Src_freebuf
|
||||
from GotoSend.qianxin import Src_qianxin
|
||||
from GotoSend.seebug import Src_seebug
|
||||
from GotoSend.sougou_wx import Src_sougou_wx
|
||||
from GotoSend.github import Src_github
|
||||
from config.check_config import get_core_config, get_debug_config, get_kewords_config
|
||||
from loguru import logger
|
||||
# import schedule
|
||||
# import os
|
||||
# import signal
|
||||
# import sys
|
||||
# import time
|
||||
# import yaml
|
||||
# import requests
|
||||
# from datetime import datetime, timedelta
|
||||
# from SendCore.FeishuSendBot import SendToFeishu, gen_sign
|
||||
# from SendCore.QiweiSendBot import SendToWX
|
||||
# from spider.common import run, seebug_main, M_4hou_main, anquanke_main, sec_wiki_main, huawei_main, doonsec_main, qianxin_main
|
||||
# from spider.freebuf import freebuf_main
|
||||
# from spider.xianzhi import xianzhi_main
|
||||
# from spider.sougou_wx import sougou_wx_main
|
||||
# from spider.github import github_main, load_github_config
|
||||
# from GotoSend.M_4hou import Src_4hou
|
||||
# from GotoSend.anquanke import Src_anquanke
|
||||
# from GotoSend.doonsec import Src_doonsec
|
||||
# from GotoSend.xianzhi import Src_xianzhi
|
||||
# from GotoSend.freebuf import Src_freebuf
|
||||
# from GotoSend.qianxin import Src_qianxin
|
||||
# from GotoSend.seebug import Src_seebug
|
||||
# from GotoSend.sougou_wx import Src_sougou_wx
|
||||
# from GotoSend.github import Src_github
|
||||
# from config.check_config import get_core_config, get_debug_config, get_kewords_config
|
||||
# from loguru import logger
|
||||
|
||||
# 全局变量
|
||||
webhook_url_once, timestamp_once, sign_once = gen_sign()
|
||||
e_hour, time_choice, choice, fs_activate, wx_activate, ding_activate, lx_activate, url_web = get_core_config()
|
||||
Sogou_WX, Doonsec_switch, Doonsec = get_kewords_config()
|
||||
# print(f"当前配置信息:Doonsec_switch:{Doonsec_switch}")
|
||||
# from baiduspider import BaiduSpider
|
||||
# from pprint import pprint
|
||||
|
||||
# # 全局变量
|
||||
# webhook_url_once, timestamp_once, sign_once = gen_sign()
|
||||
# e_hour, time_choice, choice, fs_activate, wx_activate, ding_activate, lx_activate, url_web = get_core_config()
|
||||
# Sogou_WX, Doonsec_switch, Doonsec = get_kewords_config()
|
||||
# # print(f"当前配置信息:Doonsec_switch:{Doonsec_switch}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# result_doonsec_long = Src_doonsec(False, Doonsec_switch, Doonsec)
|
||||
# print(result_doonsec_long)
|
||||
while True:
|
||||
Sogou_WX, Doonsec_switch, Doonsec = get_kewords_config()
|
||||
print(f"当前配置信息:Doonsec_switch:{Doonsec_switch}")
|
||||
print(f"当前配置信息:Sogou_WX:{Sogou_WX}")
|
||||
print(f"当前配置信息:Doonsec:{Doonsec}")
|
||||
print("\n")
|
||||
time.sleep(10)
|
||||
# # if __name__ == "__main__":
|
||||
# # result_doonsec_long = Src_doonsec(False, Doonsec_switch, Doonsec)
|
||||
# # print(result_doonsec_long)
|
||||
# # while True:
|
||||
# # Sogou_WX, Doonsec_switch, Doonsec = get_kewords_config()
|
||||
# # print(f"当前配置信息:Doonsec_switch:{Doonsec_switch}")
|
||||
# # print(f"当前配置信息:Sogou_WX:{Sogou_WX}")
|
||||
# # print(f"当前配置信息:Doonsec:{Doonsec}")
|
||||
# # print("\n")
|
||||
# # time.sleep(10)
|
||||
# # pprint(BaiduSpider().search_web(input(), exclude=['all']))
|
||||
|
||||
# import requests
|
||||
|
||||
# def fetch_url(url, headers):
|
||||
# try:
|
||||
# response = requests.get(url, headers=headers)
|
||||
# response.raise_for_status() # 如果响应状态码不是200,会抛出异常
|
||||
# return response.text
|
||||
# except requests.RequestException as e:
|
||||
# print(f"请求失败: {e}")
|
||||
# return None
|
||||
|
||||
# # 示例使用
|
||||
# if __name__ == "__main__":
|
||||
# url = "https://www.baidu.com/s?tn=baidurt&cl=3&rn=20&ie=utf-8&rsv_bp=1&wd=齐鲁银行" # 替换为你要爬取的URL
|
||||
# headers = {
|
||||
# "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3",
|
||||
# "Accept-Language": "en-US,en;q=0.9",
|
||||
# # 可以在这里添加其他需要的头信息
|
||||
# }
|
||||
|
||||
# content = fetch_url(url, headers)
|
||||
# if content:
|
||||
# print(content)
|
||||
'''
|
||||
<table cellpadding="0" cellspacing="0" class="result" id="8">
|
||||
<tr>
|
||||
<td class=f>
|
||||
<h3 class="t">
|
||||
<a
|
||||
|
||||
|
||||
onmousedown="return ns_c({
|
||||
'fm':'baidurt',
|
||||
'F':'778317EA',
|
||||
'F1':'9D73F1C4',
|
||||
'F2':'4CA6DE6A',
|
||||
'F3':'54E5243F',
|
||||
'T':'1736494872',
|
||||
'title':this.innerHTML,
|
||||
'url':'https%3A%2F%2Fwww.aiqicha.com%2Fcompany_detail_82845142671484',
|
||||
'p1':8,
|
||||
'y':'CBDFF3F7'})"
|
||||
|
||||
href="https://www.aiqicha.com/company_detail_82845142671484"
|
||||
|
||||
target="_blank"
|
||||
|
||||
>
|
||||
|
||||
山东省<em>城市商业银行</em>合作<em>联盟</em>有限公司 - 爱企查
|
||||
</a>
|
||||
</h3>
|
||||
<font size=-1>
|
||||
|
||||
|
||||
<div class="realtime">
|
||||
|
||||
2024-11-29
|
||||
|
||||
</div>
|
||||
|
||||
目前,<em>联盟</em>共有15家<em>城商行</em>股东,注册资本10.45亿元,线上运营银行资产突破3万亿元。公司自成立以来,以提升成员行信息科技支撑水平和风险治理水平为重点,为67家成员行提供了持续、稳定、强大的信息系统支撑,引领成员行通过科技创新推动业务发展和转型升级。公司接受监管部门严格的信息科技风险评估和监管,被原中国银监会列入首...
|
||||
|
||||
<br>
|
||||
|
||||
<font color="#008000">
|
||||
<!--{cmt 有些url是dx生成的, 需要对二级目录进行飘粗, dx保证长度, 这里不需要截断}-->
|
||||
www.aiqicha.com/company_detail_82845...
|
||||
</font>
|
||||
- <a data-nolog href="http://cache.baiducontent.com/c?m=3acHSY3QSgkEw1sXW0UKzpyLjYru1huJJy0xUzV0yis6Cm9IHy_sypubAlV_Y-HWxpoUNk7WMqL-9pivNrI_Ok6p3R4wgYIQ3k0K1CMVMm5tRNn2c10xpHN5pXMeJY12&p=93759a44d7d51de51cb5c7710f5f&newp=89759a44d79217dd0be2963e615c92695d0fc20e3cd6d601298ffe0cc4241a1a1a3aecb833647d45848773305df9180a98&s=1543843a4723ed2a&user=baidu&fm=sc&query=%25B3%25C7%25C9%25CC%25D0%25D0%25C1%25AA%25C3%25CB&qid=ced952bc00004e47&p1=8"
|
||||
target="_blank"
|
||||
class="m">
|
||||
百度快照
|
||||
</a> <br>
|
||||
|
||||
</font>
|
||||
</td>
|
||||
</tr>
|
||||
</table><br>
|
||||
'''
|
Binary file not shown.
194
GotoSend/baidu.py
Normal file
194
GotoSend/baidu.py
Normal file
@ -0,0 +1,194 @@
|
||||
import os
|
||||
import json
|
||||
import sqlite3
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
def clear_table():
|
||||
conn = sqlite3.connect('./resources/db/baidu.db')
|
||||
cursor = conn.cursor()
|
||||
cursor.execute('DELETE FROM articles')
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
def create_database():
|
||||
conn = sqlite3.connect('./resources/db/baidu.db')
|
||||
cursor = conn.cursor()
|
||||
cursor.execute('''CREATE TABLE IF NOT EXISTS articles (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
title TEXT,
|
||||
link TEXT,
|
||||
description TEXT,
|
||||
pubDate DATETIME,
|
||||
author TEXT,
|
||||
keyword TEXT,
|
||||
is_sended BOOLEAN
|
||||
)''')
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
def insert_data(data):
|
||||
conn = sqlite3.connect('./resources/db/baidu.db')
|
||||
cursor = conn.cursor()
|
||||
for entry in data:
|
||||
# 检查是否存在相同 title 的记录
|
||||
cursor.execute('''
|
||||
SELECT 1 FROM articles WHERE title = ? AND author = ?
|
||||
''', (entry['title'], entry['author']))
|
||||
|
||||
if cursor.fetchone() is None:
|
||||
# 如果没有找到相同记录,则插入新记录
|
||||
cursor.execute('''
|
||||
INSERT INTO articles (title, link, description, pubDate, author, keyword)
|
||||
VALUES (?, ?, ?, ?, ?, ?)
|
||||
''', (entry['title'], entry['link'], entry['description'], entry['pubDate'], entry['author'], entry['keyword']))
|
||||
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
def get_json():
|
||||
# 检查文件是否存在
|
||||
if not os.path.exists('./resources/JSON/baidu.json'):
|
||||
raise FileNotFoundError("baidu.json文件不存在,请检查程序是否运行正常!")
|
||||
|
||||
# 打开并读取JSON文件
|
||||
with open('./resources/JSON/baidu.json', 'r', encoding='utf-8') as file:
|
||||
data = json.load(file)
|
||||
|
||||
# 假设data是一个包含多个关键词的字典
|
||||
total_data = []
|
||||
for keyword, keyword_data in data.items():
|
||||
# 检查关键词对应的数据是否为列表
|
||||
if not isinstance(keyword_data, list):
|
||||
raise ValueError(f"关键词 {keyword} 对应的数据格式错误,请检查爬取程序是否异常!")
|
||||
|
||||
# 提取所需字段并编号
|
||||
for index, item in enumerate(keyword_data, start=1):
|
||||
entry = {
|
||||
"id": index,
|
||||
"title": item.get("title", ""),
|
||||
"link": item.get("link", ""),
|
||||
"description": item.get("description", ""),
|
||||
"pubDate": item.get("pubDate", ""),
|
||||
"author": item.get("author", ""),
|
||||
"keyword": keyword
|
||||
}
|
||||
total_data.append(entry)
|
||||
|
||||
return total_data
|
||||
|
||||
def select_articles():
|
||||
conn = sqlite3.connect('./resources/db/baidu.db')
|
||||
cursor = conn.cursor()
|
||||
|
||||
# 获取当前日期和时间
|
||||
now = datetime.now()
|
||||
two_months_ago = now - timedelta(days=60) # 假设两个月大约60天
|
||||
|
||||
try:
|
||||
# 查询最近且未被标记为True的消息且发布时间不超过两个月
|
||||
cursor.execute('''
|
||||
SELECT * FROM articles
|
||||
WHERE is_sended IS NULL AND pubDate BETWEEN ? AND ?
|
||||
ORDER BY pubDate DESC
|
||||
''', (two_months_ago.strftime('%Y-%m-%d'), now.strftime('%Y-%m-%d')))
|
||||
|
||||
# 查询最近且未被标记为True的消息
|
||||
# cursor.execute('''
|
||||
# SELECT * FROM articles
|
||||
# WHERE is_sended IS NULL
|
||||
# ORDER BY pubDate DESC
|
||||
# ''')
|
||||
|
||||
results = cursor.fetchall()
|
||||
# print(results)
|
||||
|
||||
if results:
|
||||
for row in results:
|
||||
article_id = row[0]
|
||||
cursor.execute('''
|
||||
UPDATE articles
|
||||
SET is_sended = True
|
||||
WHERE id = ?
|
||||
''', (article_id,))
|
||||
|
||||
conn.commit() # 提交事务
|
||||
|
||||
except Exception as e:
|
||||
conn.rollback() # 回滚事务
|
||||
print(f"Error: {e}")
|
||||
finally:
|
||||
cursor.close()
|
||||
conn.close()
|
||||
|
||||
return results
|
||||
|
||||
def record_md(result, filename="./resources/history/baidu_news.md"):
|
||||
# 读取现有内容
|
||||
if os.path.exists(filename):
|
||||
with open(filename, 'r', encoding='utf-8') as file:
|
||||
existing_content = file.read()
|
||||
else:
|
||||
existing_content = ""
|
||||
|
||||
# 将新内容插入到现有内容的开头
|
||||
new_content = result + existing_content
|
||||
|
||||
# 写回文件
|
||||
with open(filename, 'w', encoding='utf-8') as file:
|
||||
file.write(new_content)
|
||||
|
||||
def get_filtered_articles(entries, Is_short):
|
||||
result = ""
|
||||
record = ""
|
||||
for entry in entries:
|
||||
if Is_short == False:
|
||||
result += f"文章:[{entry[1]}]({entry[2]})\n描述:{entry[3]}\n"
|
||||
result += f"发布时间:{entry[4]}\n"
|
||||
result += f"来源:{entry[5]}\n"
|
||||
result += f"关键词:{entry[6]}\n"
|
||||
result += "\n" + "-" * 40 + "\n" # 添加分隔线以便区分不同文章
|
||||
if Is_short == True:
|
||||
result += f"文章:[{entry[1]}]({entry[2]})"
|
||||
result += f"上传时间:{entry[4]}\n"
|
||||
result += "\n" + "-" * 3 + "\n" # 添加分隔线以便区分不同文章
|
||||
|
||||
record += f"#### 文章:[{entry[1]}]({entry[2]})\n描述:{entry[3]}\n"
|
||||
record += f"**上传时间**:{entry[4]}\n"
|
||||
record += f"**来源**:{entry[5]}\n"
|
||||
record += f"**关键词**:{entry[6]}\n"
|
||||
record += "\n" + "-" * 40 + "\n" # 添加分隔线以便区分不同文章
|
||||
record_md(record)
|
||||
return result
|
||||
|
||||
def Src_baidu(Is_short):
|
||||
if not os.path.exists('./resources/db/baidu.db'):
|
||||
# 创建数据库和表
|
||||
create_database()
|
||||
|
||||
# 清空表
|
||||
# clear_table()
|
||||
|
||||
# 获取 JSON 数据
|
||||
baidu_data = get_json()
|
||||
|
||||
# 插入数据到数据库
|
||||
insert_data(baidu_data)
|
||||
|
||||
# 查询指定时间段内的数据
|
||||
filtered_articles = select_articles()
|
||||
# print(filtered_articles)
|
||||
|
||||
if filtered_articles:
|
||||
results = get_filtered_articles(filtered_articles, Is_short)
|
||||
return results
|
||||
else:
|
||||
return False
|
||||
|
||||
if __name__ == "__main__":
|
||||
reslts = Src_baidu(False)
|
||||
if reslts != False:
|
||||
print(reslts)
|
||||
else:
|
||||
# 如果为空,则跳过执行
|
||||
print("-" * 40)
|
||||
print("微信公众号数据为空,跳过执行。")
|
@ -312,7 +312,7 @@ def get_filtered_articles(entries, Is_short, choice):
|
||||
result += f"项目:[{entry[1]}]({entry[2]})存在更新!!!\n"
|
||||
result += f"更新描述:{entry[3]}\n"
|
||||
result += f"更新时间:{entry[4]}\n"
|
||||
result += f"提交者:{entry[5]},[点此查看提交详情]({entry[6]})\n"
|
||||
result += f"提交者:{entry[5]},[点此查看提交详情]({entry[7]})\n"
|
||||
result += "\n" + "-" * 10 + "\n" # 添加分隔线以便区分不同文章
|
||||
elif choice == 3:
|
||||
result += f"大佬 {entry[5]} 上传了一个新工具:[{entry[1]}]({entry[2]})\n"
|
||||
@ -333,7 +333,7 @@ def get_filtered_articles(entries, Is_short, choice):
|
||||
result += f"项目:[{entry[1]}]({entry[2]})存在更新!!!\n"
|
||||
result += f"更新描述:{entry[3]}\n"
|
||||
result += f"更新时间:{entry[4]}\n"
|
||||
result += f"提交者:{entry[5]},[点此查看提交详情]({entry[6]})\n"
|
||||
result += f"提交者:{entry[5]},[点此查看提交详情]({entry[7]})\n"
|
||||
result += "\n" + "-" * 3 + "\n" # 添加分隔线以便区分不同文章
|
||||
elif choice == 3:
|
||||
result += f"大佬 {entry[5]} 上传了一个新工具:[{entry[1]}]({entry[2]})\n"
|
||||
@ -355,7 +355,7 @@ def get_filtered_articles(entries, Is_short, choice):
|
||||
record += f"#### 项目:[{entry[1]}]({entry[2]})存在更新!!!\n"
|
||||
record += f"**更新描述**:{entry[3]}\n"
|
||||
record += f"**更新时间**:{entry[4]}\n"
|
||||
record += f"**提交者**:{entry[5]},[点此查看提交详情]({entry[6]})\n"
|
||||
record += f"**提交者**:{entry[5]},[点此查看提交详情]({entry[7]})\n"
|
||||
record += "\n" + "-" * 10 + "\n" # 添加分隔线以便区分不同文章
|
||||
elif choice == 3:
|
||||
record += f"#### 大佬 {entry[5]} 上传了一个新工具:[{entry[1]}]({entry[2]})\n"
|
||||
@ -404,7 +404,7 @@ def Src_github(e_hour, Is_short):
|
||||
return result_1, result_2, result_3, result_4
|
||||
|
||||
if __name__ == "__main__":
|
||||
result_1, result_2, result_3, result_4 = Src_github(24000, False)
|
||||
result_1, result_2, result_3, result_4 = Src_github(240, False)
|
||||
if result_1 != "":
|
||||
print(result_1)
|
||||
if result_2 != "":
|
||||
|
@ -38,4 +38,5 @@
|
||||
- 2025年01月02日晚:再次优化了文件结构,提高可读性 <br>
|
||||
- 2025年01月05日晚:修复了doonsec相关配置的bug,程序现已可正常运行 <br>
|
||||
- 2025年01月06日:更新了配置信息自动获取的逻辑,添加关键词等现可在运行时添加,重要配置信息(config.yaml)仍需暂停重新运行 <br>
|
||||
- 2025年01月10日:修复了github推送的问题(时区,消息配置错误等) <br>
|
||||
- 2025年01月10日上午:修复了github推送的问题(时区,消息配置错误等) <br>
|
||||
- 2025年01月10日下午:上线了百度搜索内容监测 <br>
|
@ -66,15 +66,19 @@ def get_debug_config():
|
||||
|
||||
return debug
|
||||
|
||||
def get_kewords_config():
|
||||
def get_kewords_config(item):
|
||||
with open('./config/keywords.yaml', 'r', encoding="utf-8") as file:
|
||||
config = yaml.safe_load(file)
|
||||
Sogou_WX = config['Sogou-WX']
|
||||
Doonsec_switch = config.get('Doonsec-switch', False)
|
||||
Doonsec = config['Doonsec']
|
||||
if item == 'Doonsec':
|
||||
Doonsec_switch = config.get('Doonsec-switch', False)
|
||||
Doonsec = config['Doonsec']
|
||||
return Doonsec_switch, Doonsec
|
||||
elif item == 'Sogou-WX':
|
||||
Sogou_WX = config['Sogou-WX']
|
||||
return Sogou_WX
|
||||
elif item == 'Baidu':
|
||||
Baidu = config['Baidu']
|
||||
return Baidu
|
||||
else:
|
||||
logger.error("参数错误,请检查./config/keywords.yaml")
|
||||
|
||||
# print (Sogou_WX, Doonsec_switch, Doonsec)
|
||||
return Sogou_WX, Doonsec_switch, Doonsec
|
||||
|
||||
if __name__ == "__main__":
|
||||
get_kewords_config()
|
@ -31,6 +31,7 @@ mode: [1, 2] # 运行模式,可多选
|
||||
# 0:启用RSS抓取模式
|
||||
# 1:启用搜狗-微信公众号文章监测
|
||||
# 2:启用github项目监测
|
||||
# 3:启用百度搜索内容监测
|
||||
|
||||
# 网址配置
|
||||
url: https://info.masonliu.com/ # 请设置为您自己反代的域名,或者改为 http://127.0.0.1:5000 或者对应IP域名
|
||||
|
@ -1,3 +1,4 @@
|
||||
Sogou-WX: ["银行测试", "APP逆向", "渗透测试", "手机银行漏洞", "银行漏洞", "支付漏洞"] # 基于搜狗引擎搜索特定关键词的微信公众号文章
|
||||
Doonsec-switch: False
|
||||
Doonsec: ["逆向", "解包", "POC"] # 洞见微信安全资讯关键词
|
||||
Baidu: ["银行测试", "APP逆向", "渗透测试", "手机银行漏洞", "银行漏洞", "支付漏洞"] # 基于百度搜索特定关键词的文章
|
144
resources/JSON/baidu.json
Normal file
144
resources/JSON/baidu.json
Normal file
@ -0,0 +1,144 @@
|
||||
{
|
||||
"齐鲁银行": [
|
||||
{
|
||||
"title": "齐鲁银行在您身旁",
|
||||
"link": "https://www.qlbchina.com/",
|
||||
"description": "关于规范个人贷款资金使用及警惕冒用银行名义营销的风险提示 — 2024年11月26日 关于银行卡系统维护的公告 — 2024年11月25日 齐鲁银行 关于金融IC借记卡有效期到期服务的客户公告 — 2024年11月22日 关于发售2025年第1期齐鲁银行济南市外机构个人大额存单(3年期 )的公告 ...",
|
||||
"author": "百度快照",
|
||||
"pubDate": "2024-10-22"
|
||||
},
|
||||
{
|
||||
"title": "齐鲁银行在您身旁总行",
|
||||
"link": "https://www.qlbchina.com/qlbchina/jrql/xwgg/cggg/zx/index.html",
|
||||
"description": "齐鲁银行 银企大集系统优化升级项目(二次)竞争性磋商公告 [2025-01-06] 齐鲁银行信用卡多渠道进件及信用卡审批系统人力外包项目(二次)竞争性磋商公告 [2025-01-06] 齐鲁银行村镇智能柜台系统改造项目竞争性磋商公告 [2025-01-03] 齐鲁银行商用密码安全评估服务项目 ...",
|
||||
"author": "百度快照",
|
||||
"pubDate": "2025-01-06"
|
||||
},
|
||||
{
|
||||
"title": "齐鲁银行(601665)_股票行情,行情首页_中财网",
|
||||
"link": "https://gg.cfi.cn/quote.aspx?stockid=92680&contenttype=outline&client=pc",
|
||||
"description": "中财网提供 齐鲁银行 (601665)实时行情动态分析,全面报道齐鲁银行(601665)基本资料及重大新闻、行业资讯,浏览齐鲁银行(601665)财务数据、行情数据,公司公告,重大事件。",
|
||||
"author": "百度快照",
|
||||
"pubDate": "2024-12-31"
|
||||
},
|
||||
{
|
||||
"title": "齐鲁银行股份有限公司德州分行 - 天眼查",
|
||||
"link": "https://www.tianyancha.com/company/2354701752",
|
||||
"description": "简介: 齐鲁银行 股份有限公司德州分行,成立于2014年,位于山东省德州市,是一家以从事货币金融服务为主的企业。通过天眼查大数据分析,齐鲁银行股份有限公司德州分行参与招投标项目9次;此外企业还拥有行政许可8个。风险方面共发现企业有 展开 财产线索 线索47预估价值1亿元 ...",
|
||||
"author": "百度快照",
|
||||
"pubDate": "2024-12-09"
|
||||
},
|
||||
{
|
||||
"title": "齐鲁银行聊城分行 - 百度百科",
|
||||
"link": "https://baike.baidu.com/item/%E9%BD%90%E9%B2%81%E9%93%B6%E8%A1%8C%E8%81%8A%E5%9F%8E%E5%88%86%E8%A1%8C/6555695",
|
||||
"description": "作为 齐鲁银行 第一家异地分行,聊城分行自2008年3月19日成立以来,在聊城市委、市政府的领导下,在各级各部门的大力支持和帮助下,始终坚持“服务地方经济,服务中小企业,服务市民百姓”的市场定位,以创建“中小企业首选银行”为目标,将营销和服务的重点放在了中小企业和居民个人业务上,优质高效地开展金融服务,有力...",
|
||||
"author": "百度快照",
|
||||
"pubDate": "2024-07-22"
|
||||
},
|
||||
{
|
||||
"title": "齐鲁银行信用卡申请进度入口查询 - 首页",
|
||||
"link": "https://ebank.qlbchina.com/pbank/",
|
||||
"description": "正在加载请稍候……",
|
||||
"author": "百度快照",
|
||||
"pubDate": "2025-01-08"
|
||||
},
|
||||
{
|
||||
"title": "14项违规!齐鲁银行收1495万罚单,副行长陶文喆连带被罚 - 知乎",
|
||||
"link": "https://zhuanlan.zhihu.com/p/677564348",
|
||||
"description": "最近,国家金融监管总局山东监管局披露相关罚单,显示 齐鲁银行 因存在14项主要违法违规事实,被没收违法所得并罚款合计1495.126802万元。其中,分支机构罚没120万,总行罚没1375.126802万元,罚单开出时间为2023年12月28日。 具体而言,齐鲁银行此次罚单涉及的违法违规事实包括小微企业划型不到位;违规向小微企业收取费用;个贷、房地...",
|
||||
"author": "百度快照",
|
||||
"pubDate": "2024-01-12"
|
||||
},
|
||||
{
|
||||
"title": "齐鲁银行是国企还是私企?",
|
||||
"link": "http://baijiahao.baidu.com/s?id=1716751640979713811&wfr=spider&for=pc",
|
||||
"description": "齐鲁银行 的性质属于私企,它在1996年6月份正式成立齐鲁银行,有众多股东,这其中包括国有公司中资法人的公司,个人企业以及外资公司等共同组建,是一家股份制的商业银行。它也是全国首批设立的城市商业银行,总部就位于山东的省会济南,该公司最大的股东就是澳洲联邦银行。齐鲁银行作为一家地方性银行,其涵盖领域众多,...",
|
||||
"author": "百度快照",
|
||||
"pubDate": "2021-11-18"
|
||||
},
|
||||
{
|
||||
"title": "齐鲁银行违反《反洗钱法》规定 被罚款30万元 - 每日经济新闻",
|
||||
"link": "http://baijiahao.baidu.com/s?id=1651509754800941149&wfr=spider&for=pc",
|
||||
"description": "齐鲁银行 的性质属于私企,它在1996年6月份正式成立齐鲁银行,有众多股东,这其中包括国有公司中资法人的公司,个人企业以及外资公司等共同组建,是一家股份制的商业银行。它也是全国首批设立的城市商业银行,总部就位于山东的省会济南,该公司最大的股东就是澳洲联邦银行。齐鲁银行作为一家地方性银行,其涵盖领域众多,...",
|
||||
"author": "百度快照",
|
||||
"pubDate": "No timestamp found"
|
||||
},
|
||||
{
|
||||
"title": "齐鲁银行5.40(-1.46%)_股票行情_新浪财经_新浪网",
|
||||
"link": "http://finance.sina.com.cn/realstock/company/sh601665/nc.shtml",
|
||||
"description": "新浪财经为您提供 齐鲁银行 (601665)股票实时行情走势,实时资金流向,实时新闻资讯,研究报告,股吧互动,交易信息,个股点评,公告,财务指标分析等与齐鲁银行(601665)股票相关的信息与服务.",
|
||||
"author": "百度快照",
|
||||
"pubDate": "2025-01-08"
|
||||
},
|
||||
{
|
||||
"title": "齐鲁银行",
|
||||
"link": "http://gjxy.sdau.edu.cn/2017/1226/c3557a119546/page.htm",
|
||||
"description": "2008年11月30日,该行天津分行开业,由此成为山东省首家在省外异地设立分行的城市商业银行。 2010年8月27日,青岛分行成立。 截至2009年12月31日, 齐鲁银行 辖有72家分、支行(部),在岗员工1800余人。全行总资产617.35亿元,是成立之初的19倍;各项存款余额546.55亿元,是成立时的20倍;各项贷款余额353.1亿元,是成立时的20...",
|
||||
"author": "百度快照",
|
||||
"pubDate": "2017-12-26"
|
||||
},
|
||||
{
|
||||
"title": "齐鲁银行(601665)股本结构_新浪财经_新浪网",
|
||||
"link": "http://vip.stock.finance.sina.com.cn/corp/go.php/vCI_StockStructure/stockid/601665.phtml",
|
||||
"description": "齐鲁银行 5.59 -0.06-1.06% 2024-12-31 15:00:01 昨收盘:5.65今开盘:5.65最高价:5.70最低价:5.59 市值:270.28亿元 流通:270.28成交:347797手 换手:0.72% 公司资料意见反馈 公司资料: 公司简介 股本结构 主要股东 流通股股东 基金持股 公司高管 公司章程 ...",
|
||||
"author": "百度快照",
|
||||
"pubDate": "2024-12-31"
|
||||
},
|
||||
{
|
||||
"title": "齐鲁银行(QILU BANK)",
|
||||
"link": "https://bank.cngold.org/index_51.html",
|
||||
"description": "简要名称: 齐鲁银行 法人代表:邱云章成立日期:1996-06-06 银行性质:城市商业银行银行行长:郭涛注册资金: 客服热线:40060-96588公司总部:济南市顺河街176号 银行简介:济南市商业银行是山东省成立的首家地方性股份制商业银行。1996年6月6日,在济南市16家城市信用社和1家城信社联社的基础上组建了济南城市合作银行;1998年...",
|
||||
"author": "百度快照",
|
||||
"pubDate": "2022-11-09"
|
||||
},
|
||||
{
|
||||
"title": "齐鲁银行- 搜狗百科",
|
||||
"link": "https://baike.sogou.com/v7655626.htm",
|
||||
"description": "齐鲁银行 (Qilu Bank)是一家由国有股份、中资法人股份、外资股份和众多个人股份等共同组成独立法人资格的股份制商业银行,实行一级法人体制,成立于1996年6月,总部位于山东省济南市。其原名济南城市合作银行,于1998年6月6日更名为济南市商业银行,于2009年6月更名为齐鲁",
|
||||
"author": "百度快照",
|
||||
"pubDate": "2024-07-10"
|
||||
},
|
||||
{
|
||||
"title": "齐鲁银行(601665)_股票价格_行情_走势图—东方财富网",
|
||||
"link": "http://quote.eastmoney.com/unify/r/1.601665?from=classic&eventcode=Web_quote_entrance1",
|
||||
"description": "提供 齐鲁银行 (601665)股票的行情走势、五档盘口、逐笔交易等实时行情数据,及齐鲁银行(601665)的新闻资讯、公司公告、研究报告、行业研报、F10资料、行业资讯、资金流分析、阶段涨幅、所属板块、财务指标、机构观点、行业排名、估值水平、股吧互动等与齐鲁银行(601665)有关",
|
||||
"author": "百度快照",
|
||||
"pubDate": "2025-01-03"
|
||||
},
|
||||
{
|
||||
"title": "齐鲁银行",
|
||||
"link": "https://yqhome.qlbchina.com/",
|
||||
"description": "服务热线:40060-96588 账号登录 UKey登录 立即登录 立即注册忘记密码保函查验",
|
||||
"author": "百度快照",
|
||||
"pubDate": "2025-01-08"
|
||||
},
|
||||
{
|
||||
"title": "齐鲁银行(601665.SH)公司高管-PC_HSF10资料",
|
||||
"link": "http://f10.eastmoney.com/f10_v2/CompanyManagement.aspx?code=sh601665",
|
||||
"description": "信贷处办事员、办公室科长,中国农业银行泰安市分行党委委员、副行长,中国农业银行山东省分行办公室副主任、主任,中国农业银行山东省分行党委委员、行长助理,中国农业银行山东省分行党委委员、行长助理兼东营市分行党委书记、行长,中国农业银行山东省分行党委委员、副行长,中国农业银行天津市分行党委书记、行长, 齐鲁银行 党委...",
|
||||
"author": "百度快照",
|
||||
"pubDate": "2024-12-06"
|
||||
},
|
||||
{
|
||||
"title": "齐鲁银行山东省网点地址电话查询_齐鲁银行网点-金投网(手机金投网...",
|
||||
"link": "http://bank.cngold.org/yhwd/list_city_51_16.html",
|
||||
"description": "齐鲁银行 客服热线:40060-96588 简要名称:齐鲁银行 法定名称:齐鲁银行 银行性质: 城市商业银行 公司总部:济南市顺河街176号山东省-齐鲁银行网点查询 济南(共有105个齐鲁银行网点) 青岛(共有2个齐鲁银行网点) 聊城(共有7个齐鲁银行网点) 热门城市-齐鲁银行网点查询 北京 杭州 天津 重庆 苏州 南京 广州 厦门...",
|
||||
"author": "百度快照",
|
||||
"pubDate": "2025-01-07"
|
||||
},
|
||||
{
|
||||
"title": "齐鲁银行天津分行 - 百度百科",
|
||||
"link": "https://baike.baidu.com/item/%E9%BD%90%E9%B2%81%E9%93%B6%E8%A1%8C%E5%A4%A9%E6%B4%A5%E5%88%86%E8%A1%8C/9614852",
|
||||
"description": "天津分行是 齐鲁银行 成立的首家省外异地分行,是总行新三年发展规划战略实施的重要一步。在地方党委、政府的关怀下,在监管部门的监管指导下,在社会各界的关心支持下,分行于2008年11月30日正式对外营业。分行领导 总行副行长,天津分行党委书记:柴传早,天津分行行长:张宝银,天津分行副行长:张磊、胡立军,天津分行...",
|
||||
"author": "百度快照",
|
||||
"pubDate": "2024-07-01"
|
||||
},
|
||||
{
|
||||
"title": "齐鲁银行在您身旁齐鲁银行信用卡多渠道进件及信用卡审批系统人力...",
|
||||
"link": "https://www.qlbchina.com/qlbchina/2025-01/06/article_2025010613411012428.html",
|
||||
"description": "齐鲁银行 信用卡多渠道进件及信用卡审批系统人力外包项目(二次)竞争性磋商公告 齐鲁银行信用卡多渠道进件及信用卡审批系统人力外包项目(二次)竞争性磋商公告.docx",
|
||||
"author": "百度快照",
|
||||
"pubDate": "2024-12-27"
|
||||
}
|
||||
]
|
||||
}
|
BIN
resources/db/baidu.db
Normal file
BIN
resources/db/baidu.db
Normal file
Binary file not shown.
70
resources/history/baidu_news.md
Normal file
70
resources/history/baidu_news.md
Normal file
@ -0,0 +1,70 @@
|
||||
#### 文章:[齐鲁银行信用卡申请进度入口查询 - 首页](https://ebank.qlbchina.com/pbank/)
|
||||
描述:正在加载请稍候……
|
||||
**上传时间**:2025-01-08
|
||||
**来源**:百度快照
|
||||
**关键词**:齐鲁银行
|
||||
|
||||
----------------------------------------
|
||||
#### 文章:[齐鲁银行5.40(-1.46%)_股票行情_新浪财经_新浪网](http://finance.sina.com.cn/realstock/company/sh601665/nc.shtml)
|
||||
描述:新浪财经为您提供 齐鲁银行 (601665)股票实时行情走势,实时资金流向,实时新闻资讯,研究报告,股吧互动,交易信息,个股点评,公告,财务指标分析等与齐鲁银行(601665)股票相关的信息与服务.
|
||||
**上传时间**:2025-01-08
|
||||
**来源**:百度快照
|
||||
**关键词**:齐鲁银行
|
||||
|
||||
----------------------------------------
|
||||
#### 文章:[齐鲁银行山东省网点地址电话查询_齐鲁银行网点-金投网(手机金投网...](http://bank.cngold.org/yhwd/list_city_51_16.html)
|
||||
描述:齐鲁银行 客服热线:40060-96588 简要名称:齐鲁银行 法定名称:齐鲁银行 银行性质: 城市商业银行 公司总部:济南市顺河街176号山东省-齐鲁银行网点查询 济南(共有105个齐鲁银行网点) 青岛(共有2个齐鲁银行网点) 聊城(共有7个齐鲁银行网点) 热门城市-齐鲁银行网点查询 北京 杭州 天津 重庆 苏州 南京 广州 厦门...
|
||||
**上传时间**:2025-01-07
|
||||
**来源**:百度快照
|
||||
**关键词**:齐鲁银行
|
||||
|
||||
----------------------------------------
|
||||
#### 文章:[齐鲁银行在您身旁总行](https://www.qlbchina.com/qlbchina/jrql/xwgg/cggg/zx/index.html)
|
||||
描述:齐鲁银行 银企大集系统优化升级项目(二次)竞争性磋商公告 [2025-01-06] 齐鲁银行信用卡多渠道进件及信用卡审批系统人力外包项目(二次)竞争性磋商公告 [2025-01-06] 齐鲁银行村镇智能柜台系统改造项目竞争性磋商公告 [2025-01-03] 齐鲁银行商用密码安全评估服务项目 ...
|
||||
**上传时间**:2025-01-06
|
||||
**来源**:百度快照
|
||||
**关键词**:齐鲁银行
|
||||
|
||||
----------------------------------------
|
||||
#### 文章:[齐鲁银行(601665)_股票价格_行情_走势图—东方财富网](http://quote.eastmoney.com/unify/r/1.601665?from=classic&eventcode=Web_quote_entrance1)
|
||||
描述:提供 齐鲁银行 (601665)股票的行情走势、五档盘口、逐笔交易等实时行情数据,及齐鲁银行(601665)的新闻资讯、公司公告、研究报告、行业研报、F10资料、行业资讯、资金流分析、阶段涨幅、所属板块、财务指标、机构观点、行业排名、估值水平、股吧互动等与齐鲁银行(601665)有关
|
||||
**上传时间**:2025-01-03
|
||||
**来源**:百度快照
|
||||
**关键词**:齐鲁银行
|
||||
|
||||
----------------------------------------
|
||||
#### 文章:[齐鲁银行(601665)_股票行情,行情首页_中财网](https://gg.cfi.cn/quote.aspx?stockid=92680&contenttype=outline&client=pc)
|
||||
描述:中财网提供 齐鲁银行 (601665)实时行情动态分析,全面报道齐鲁银行(601665)基本资料及重大新闻、行业资讯,浏览齐鲁银行(601665)财务数据、行情数据,公司公告,重大事件。
|
||||
**上传时间**:2024-12-31
|
||||
**来源**:百度快照
|
||||
**关键词**:齐鲁银行
|
||||
|
||||
----------------------------------------
|
||||
#### 文章:[齐鲁银行(601665)股本结构_新浪财经_新浪网](http://vip.stock.finance.sina.com.cn/corp/go.php/vCI_StockStructure/stockid/601665.phtml)
|
||||
描述:齐鲁银行 5.59 -0.06-1.06% 2024-12-31 15:00:01 昨收盘:5.65今开盘:5.65最高价:5.70最低价:5.59 市值:270.28亿元 流通:270.28成交:347797手 换手:0.72% 公司资料意见反馈 公司资料: 公司简介 股本结构 主要股东 流通股股东 基金持股 公司高管 公司章程 ...
|
||||
**上传时间**:2024-12-31
|
||||
**来源**:百度快照
|
||||
**关键词**:齐鲁银行
|
||||
|
||||
----------------------------------------
|
||||
#### 文章:[齐鲁银行在您身旁齐鲁银行信用卡多渠道进件及信用卡审批系统人力...](https://www.qlbchina.com/qlbchina/2025-01/06/article_2025010613411012428.html)
|
||||
描述:齐鲁银行 信用卡多渠道进件及信用卡审批系统人力外包项目(二次)竞争性磋商公告 齐鲁银行信用卡多渠道进件及信用卡审批系统人力外包项目(二次)竞争性磋商公告.docx
|
||||
**上传时间**:2024-12-27
|
||||
**来源**:百度快照
|
||||
**关键词**:齐鲁银行
|
||||
|
||||
----------------------------------------
|
||||
#### 文章:[齐鲁银行股份有限公司德州分行 - 天眼查](https://www.tianyancha.com/company/2354701752)
|
||||
描述:简介: 齐鲁银行 股份有限公司德州分行,成立于2014年,位于山东省德州市,是一家以从事货币金融服务为主的企业。通过天眼查大数据分析,齐鲁银行股份有限公司德州分行参与招投标项目9次;此外企业还拥有行政许可8个。风险方面共发现企业有 展开 财产线索 线索47预估价值1亿元 ...
|
||||
**上传时间**:2024-12-09
|
||||
**来源**:百度快照
|
||||
**关键词**:齐鲁银行
|
||||
|
||||
----------------------------------------
|
||||
#### 文章:[齐鲁银行(601665.SH)公司高管-PC_HSF10资料](http://f10.eastmoney.com/f10_v2/CompanyManagement.aspx?code=sh601665)
|
||||
描述:信贷处办事员、办公室科长,中国农业银行泰安市分行党委委员、副行长,中国农业银行山东省分行办公室副主任、主任,中国农业银行山东省分行党委委员、行长助理,中国农业银行山东省分行党委委员、行长助理兼东营市分行党委书记、行长,中国农业银行山东省分行党委委员、副行长,中国农业银行天津市分行党委书记、行长, 齐鲁银行 党委...
|
||||
**上传时间**:2024-12-06
|
||||
**来源**:百度快照
|
||||
**关键词**:齐鲁银行
|
||||
|
||||
----------------------------------------
|
@ -0,0 +1 @@
|
||||
|
Binary file not shown.
Binary file not shown.
150
spider/baidu.py
Normal file
150
spider/baidu.py
Normal file
@ -0,0 +1,150 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
import json
|
||||
import time
|
||||
import os
|
||||
import re
|
||||
from datetime import datetime, timedelta
|
||||
from requests.exceptions import RequestException
|
||||
from loguru import logger
|
||||
|
||||
headers = {
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3",
|
||||
"Accept-Language": "en-US,en;q=0.9",
|
||||
"Cache-Control": "no-cache",
|
||||
"Connection": "keep-alive",
|
||||
"Pragma": "no-cache",
|
||||
"Sec-Fetch-Dest": "document",
|
||||
"Sec-Fetch-Mode": "navigate",
|
||||
"Sec-Fetch-Site": "same-origin",
|
||||
"Sec-Fetch-User": "?1",
|
||||
"Upgrade-Insecure-Requests": "1",
|
||||
"sec-ch-ua": '"Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"',
|
||||
"sec-ch-ua-mobile": "?0",
|
||||
"sec-ch-ua-platform": '"Windows"'
|
||||
}
|
||||
|
||||
def fetch_html(url, timeout=10):
|
||||
try:
|
||||
response = requests.get(url, headers=headers, timeout=timeout)
|
||||
response.raise_for_status()
|
||||
return response.text
|
||||
except requests.Timeout:
|
||||
logger.warning(f"请求 {url} 超时,跳过保存操作。")
|
||||
except requests.exceptions.RequestException as e:
|
||||
logger.warning(f"请求 {url} 时发生错误: {e}")
|
||||
|
||||
def normalize_pub_date(pub_date):
|
||||
# 检查是否为日期格式 2024-12-06
|
||||
if re.match(r'\d{4}-\d{2}-\d{2}', pub_date):
|
||||
return pub_date
|
||||
|
||||
# 检查是否为 '8天前' 格式
|
||||
days_ago_match = re.match(r'(\d+)天前', pub_date)
|
||||
if days_ago_match:
|
||||
days_ago = int(days_ago_match.group(1))
|
||||
return (datetime.now() - timedelta(days=days_ago)).strftime('%Y-%m-%d')
|
||||
|
||||
# 检查是否为 '小时前' 格式
|
||||
hours_ago_match = re.match(r'(\d+)小时前', pub_date)
|
||||
if hours_ago_match:
|
||||
return datetime.now().strftime('%Y-%m-%d')
|
||||
|
||||
# 如果都不匹配,返回原始值
|
||||
return pub_date
|
||||
|
||||
def parse_html(html_content):
|
||||
soup = BeautifulSoup(html_content, 'html.parser')
|
||||
|
||||
# 提取所有符合条件的<table>标签
|
||||
tables = soup.find_all('table', class_='result')
|
||||
|
||||
results = []
|
||||
|
||||
for table in tables:
|
||||
# 提取标题和链接
|
||||
h3_tag = table.find('h3', class_='t')
|
||||
if h3_tag:
|
||||
a_tag = h3_tag.find('a')
|
||||
title = a_tag.get_text(strip=True) if a_tag else "No title found"
|
||||
link = a_tag['href'] if a_tag else "No link found"
|
||||
else:
|
||||
title = "No title found"
|
||||
link = "No link found"
|
||||
|
||||
# 提取摘要
|
||||
td_element = table.find('td', class_='f')
|
||||
|
||||
# 从td中进一步查找div.realtime之后的所有文本
|
||||
realtime_div = td_element.find('div', class_='realtime')
|
||||
if realtime_div:
|
||||
text_parts = []
|
||||
for sibling in realtime_div.next_siblings:
|
||||
if sibling.name == 'font':
|
||||
break
|
||||
if isinstance(sibling, str) and sibling.strip():
|
||||
text_parts.append(sibling.strip())
|
||||
elif sibling.name and sibling.get_text(strip=True):
|
||||
text_parts.append(sibling.get_text(strip=True))
|
||||
|
||||
# 将所有文本片段合并成一个字符串,并整理格式
|
||||
cleaned_text = ' '.join(text_parts)
|
||||
|
||||
# 提取发布者
|
||||
publisher_tag = table.find('a', class_='m')
|
||||
publisher = publisher_tag.get_text(strip=True) if publisher_tag else "百度快照"
|
||||
|
||||
# 提取时间戳
|
||||
time_tag = table.find('div', class_='realtime')
|
||||
pub_date = time_tag.get_text(strip=True) if time_tag else "No timestamp found"
|
||||
pub_date = normalize_pub_date(pub_date)
|
||||
|
||||
results.append({
|
||||
"title": title,
|
||||
"link": link,
|
||||
"description": cleaned_text,
|
||||
"author": publisher,
|
||||
"pubDate": pub_date
|
||||
})
|
||||
|
||||
return results
|
||||
|
||||
def baidu_main(keywords):
|
||||
all_results = {} # 用于存储所有关键词的结果
|
||||
|
||||
for keyword in keywords:
|
||||
url = f"https://www.baidu.com/s?tn=baidurt&cl=3&rn=20&ie=utf-8&rsv_bp=1&wd={keyword}"
|
||||
# print(url)
|
||||
html_content = fetch_html(url)
|
||||
# 将解析后的数据保存到 JSON 文件
|
||||
with open('./test.html', 'w', encoding='utf-8') as f:
|
||||
f.write(html_content)
|
||||
# print(html_content)
|
||||
|
||||
if html_content is None:
|
||||
logger.warning(f"无法获取百度搜索内容,跳过保存操作。关键词: {keyword}")
|
||||
continue
|
||||
|
||||
results = parse_html(html_content)
|
||||
# 移除非法代理对
|
||||
logger.info(f"关键词【{keyword}】的百度搜索内容保存成功。")
|
||||
all_results[keyword] = results # 将结果存储在字典中,以关键词为键
|
||||
time.sleep(5)
|
||||
|
||||
# 将所有结果转换为JSON格式
|
||||
json_results = json.dumps(all_results, ensure_ascii=False, indent=4)
|
||||
# print(json_results)
|
||||
|
||||
# 确保目录存在
|
||||
os.makedirs(os.path.dirname('./resources/JSON/baidu.json'), exist_ok=True)
|
||||
|
||||
# 将解析后的数据保存到 JSON 文件
|
||||
with open('./resources/JSON/baidu.json', 'w', encoding='utf-8') as f:
|
||||
f.write(json_results)
|
||||
|
||||
if __name__ == "__main__":
|
||||
keywords = ["齐鲁银行"]
|
||||
baidu_main(keywords)
|
@ -12,12 +12,6 @@ headers = {
|
||||
"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"
|
||||
}
|
||||
|
@ -17,3 +17,6 @@ www.baidu.com/s?wd={关键词}&cl=3&pn=1&ie=utf-8&rn=20&tn=baidurt
|
||||
- python-sqlite联动
|
||||
- python-request爬虫
|
||||
- sqlite筛选
|
||||
|
||||
### 问题阐述
|
||||
- 百度抓取的文章若是时间是近日,则不会显示具体时间,而是显示【*天前】,需要处理
|
Loading…
Reference in New Issue
Block a user