Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zzsn_spider
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
丁双波
zzsn_spider
Commits
377b7a10
提交
377b7a10
authored
6月 28, 2024
作者:
XveLingKun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
微信公众号调整
上级
dc808e12
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
14 行增加
和
6 行删除
+14
-6
wxList_.py
comData/weixin_solo/wxList_.py
+14
-6
没有找到文件。
comData/weixin_solo/wxList_.py
浏览文件 @
377b7a10
...
...
@@ -12,6 +12,8 @@ from pymysql.converters import escape_string
import
sys
# sys.path.append('D:\\zzsn\\base')
from
retry
import
retry
from
base
import
BaseCore
urllib3
.
disable_warnings
(
urllib3
.
exceptions
.
InsecureRequestWarning
)
...
...
@@ -167,7 +169,7 @@ def getnumber_redis():
length
=
r
.
llen
(
'WeiXinGZH:infoSourceCode'
)
return
length
@retry
(
tries
=
2
,
delay
=
3
)
def
insertWxList
(
dic_url
,
news_title
,
url_news
,
news_date
):
selectCountSql
=
f
"select count(1) from wx_link where link='{escape_string(url_news)}'"
cursor_
.
execute
(
selectCountSql
)
...
...
@@ -183,6 +185,7 @@ def insertWxList(dic_url, news_title, url_news, news_date):
cnx_
.
commit
()
except
Exception
as
e
:
log
.
error
(
f
"保存数据库失败:{e}"
)
raise
# 查询放入之后的id
selectIdSql
=
f
"select id from wx_link where sid='{dic_url['sid']}' and link='{escape_string(url_news)}'"
cursor_
.
execute
(
selectIdSql
)
...
...
@@ -192,7 +195,7 @@ def insertWxList(dic_url, news_title, url_news, news_date):
r
.
ping
()
except
:
r_
=
redis
.
Redis
(
host
=
"114.116.90.53"
,
port
=
6380
,
password
=
'clbzzsn'
,
db
=
6
)
r_
.
lpush
(
'WeiXinGZH:
url
'
,
linkid
)
r_
.
lpush
(
'WeiXinGZH:
linkid
'
,
linkid
)
r
.
lpush
(
'WeiXinGZH:linkid'
,
linkid
)
# 表示插入数据库成功
return
1
...
...
@@ -285,10 +288,15 @@ def spider(dic_url, dic_user_count):
publish_date
=
time
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
,
publish_date
)
if
link
not
in
linke_list
:
linke_list
.
append
(
link
)
flgA
=
insertWxList
(
dic_url
,
title
,
link
,
publish_date
)
if
flgA
==
0
:
flgB
=
True
break
try
:
flgA
=
insertWxList
(
dic_url
,
title
,
link
,
publish_date
)
if
flgA
==
0
:
flgB
=
True
break
except
:
pass
if
flgB
:
break
if
flgB
:
break
if
len
(
linke_list
)
>=
total_count
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论