Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zzsn_spider
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
王景浩
zzsn_spider
Commits
09af6b88
提交
09af6b88
authored
11月 28, 2023
作者:
薛凌堃
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
采集高管不加代理ip
上级
5940b41f
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
14 行增加
和
9 行删除
+14
-9
CorePerson.py
comData/Tyc/CorePerson.py
+14
-9
没有找到文件。
comData/Tyc/CorePerson.py
浏览文件 @
09af6b88
...
...
@@ -27,7 +27,7 @@ def doJob():
# 根据从Redis中拿到的社会信用代码,在数据库中获取对应基本信息
social_code
=
baseCore
.
redicPullData
(
'CorPersonEnterprise:gnqy_socialCode'
)
# 判断 如果Redis中已经没有数据,则等待
# social_code = '91
110108778635402E
'
# social_code = '91
35020056842712XB
'
if
social_code
==
None
:
time
.
sleep
(
20
)
continue
...
...
@@ -48,10 +48,10 @@ def doJob():
retData
=
getTycIdByXYDM
(
xydm
)
if
retData
[
'state'
]:
tycid
=
retData
[
'tycData'
][
'id'
]
# todo:写入数据库
updateSql
=
f
"update EnterpriseInfo set TYCID = '{tycid}' where SocialCode = '{xydm}'"
cursor_
.
execute
(
updateSql
)
cnx_
.
commit
()
#
#
todo:写入数据库
#
updateSql = f"update EnterpriseInfo set TYCID = '{tycid}' where SocialCode = '{xydm}'"
#
cursor_.execute(updateSql)
#
cnx_.commit()
else
:
state
=
0
takeTime
=
baseCore
.
getTimeCost
(
start
,
time
.
time
())
...
...
@@ -74,7 +74,8 @@ def doJob():
#https://capi.tianyancha.com/cloud-listed-company/listed/getHkNoRepeatSeniorExecutive?_=1692929256462&gid=209370942&pageSize=20&pageNum=1
url
=
f
'https://capi.tianyancha.com/cloud-listed-company/listed/noRepeatSeniorExecutive?_={t}&gid={tycid}&pageSize=20&pageNum={page}'
ip
=
baseCore
.
get_proxy
()
res
=
requests
.
get
(
url
,
headers
=
headers
,
proxies
=
ip
)
# ,verify=False
# res = requests.get(url,headers=headers,proxies=ip) # ,verify=False
res
=
requests
.
get
(
url
,
headers
=
headers
)
# ,verify=False
time
.
sleep
(
1
)
list_all
=
res
.
json
()[
'data'
][
'dataList'
]
if
list_all
:
...
...
@@ -137,7 +138,8 @@ def doJob():
t
=
int
(
time
.
time
()
*
1000
)
url
=
f
'https://capi.tianyancha.com/cloud-listed-company/listed/getHkNoRepeatSeniorExecutive?_={t}&gid={tycid}&pageSize=20&pageNum={page}'
ip
=
baseCore
.
get_proxy
()
res
=
requests
.
get
(
url
,
headers
=
headers
,
proxies
=
ip
)
# ,verify=False
# res = requests.get(url, headers=headers, proxies=ip) # ,verify=False
res
=
requests
.
get
(
url
,
headers
=
headers
)
# ,verify=False
time
.
sleep
(
1
)
list_all
=
res
.
json
()[
'data'
][
'dataList'
]
if
list_all
:
...
...
@@ -173,7 +175,8 @@ def doJob():
t
=
int
(
time
.
time
()
*
1000
)
url
=
f
'https://capi.tianyancha.com/cloud-company-background/company/dim/staff?_={t}&gid={tycid}&pageSize=20&pageNum={page}'
ip
=
baseCore
.
get_proxy
()
res
=
requests
.
get
(
url
,
headers
=
headers
,
proxies
=
ip
)
# ,verify=False
# res = requests.get(url, headers=headers, proxies=ip) # ,verify=False
res
=
requests
.
get
(
url
,
headers
=
headers
)
# ,verify=False
time
.
sleep
(
1
)
list_all
=
res
.
json
()[
'data'
][
'result'
]
# todo:增加一种情况
...
...
@@ -211,7 +214,8 @@ def doJob():
currentTerm
=
''
person_id
=
one_info
[
'id'
]
person_url
=
f
'https://www.tianyancha.com/human/{person_id}-c{tycid}'
person_res
=
requests
.
get
(
person_url
,
headers
=
headers
,
proxies
=
ip
)
# person_res = requests.get(person_url, headers=headers, proxies=ip)
person_res
=
requests
.
get
(
person_url
,
headers
=
headers
)
person_soup
=
BeautifulSoup
(
person_res
.
content
,
'html.parser'
)
try
:
personInfo
=
person_soup
.
find
(
'span'
,
{
'class'
:
'_56d0a'
})
.
text
.
strip
()
...
...
@@ -265,6 +269,7 @@ def doJob():
log
.
info
(
'=========成功======'
)
except
Exception
as
e
:
log
.
info
(
f
'==={social_code}=====企业核心人员采集失败===重新放入redis===='
)
log
.
info
(
e
)
# 重新塞入redis
baseCore
.
rePutIntoR
(
'CorPersonEnterprise:gnqy_socialCode'
,
social_code
)
state
=
0
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论