Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zzsn_spider
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
王景浩
zzsn_spider
Commits
4dc1d9b9
提交
4dc1d9b9
authored
5月 27, 2024
作者:
XveLingKun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
企业基本信息更新
上级
71c65de8
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
11 行增加
和
8 行删除
+11
-8
baseinfo0227_tyc.py
comData/Tyc/baseinfo0227_tyc.py
+11
-8
没有找到文件。
comData/Tyc/baseinfo0227_tyc.py
浏览文件 @
4dc1d9b9
...
@@ -8,7 +8,7 @@ import pymongo
...
@@ -8,7 +8,7 @@ import pymongo
import
requests
import
requests
from
bs4
import
BeautifulSoup
from
bs4
import
BeautifulSoup
from
kafka
import
KafkaProducer
from
kafka
import
KafkaProducer
from
selenium.webdriver.edge.service
import
Service
import
urllib3
import
urllib3
from
selenium.webdriver.support.wait
import
WebDriverWait
from
selenium.webdriver.support.wait
import
WebDriverWait
...
@@ -38,7 +38,7 @@ from selenium.webdriver.common.by import By
...
@@ -38,7 +38,7 @@ from selenium.webdriver.common.by import By
def
create_driver
():
def
create_driver
():
path
=
r'D:\soft\msedgedriver.exe'
path
=
r'D:\soft\msedgedriver.exe'
service
=
Service
(
path
)
# options = webdriver.EdgeOptions()
# options = webdriver.EdgeOptions()
options
=
{
options
=
{
"browserName"
:
"MicrosoftEdge"
,
"browserName"
:
"MicrosoftEdge"
,
...
@@ -47,7 +47,7 @@ def create_driver():
...
@@ -47,7 +47,7 @@ def create_driver():
}
}
}
}
session
=
webdriver
.
Edge
(
executable_path
=
path
,
capabilities
=
options
)
session
=
webdriver
.
Edge
(
service
=
service
,
capabilities
=
options
)
return
session
return
session
...
@@ -142,7 +142,7 @@ def redaytowork(com_name, social_code, securitiesCode, securitiesShortName, list
...
@@ -142,7 +142,7 @@ def redaytowork(com_name, social_code, securitiesCode, securitiesShortName, list
else
:
else
:
return
count
return
count
except
Exception
as
e
:
except
Exception
as
e
:
log
.
info
(
f
'====={social_code}=====获取基本信息失败,重新放入redis====='
)
log
.
info
(
f
'====={social_code}=====获取基本信息失败,重新放入redis=====
{e}
'
)
# baseCore.r.lpush('BaseInfoEnterprise:gnqy_socialCode', company_field)
# baseCore.r.lpush('BaseInfoEnterprise:gnqy_socialCode', company_field)
Lreputredis
(
company_field
)
Lreputredis
(
company_field
)
token
.
updateTokeen
(
id_cookie
,
2
)
token
.
updateTokeen
(
id_cookie
,
2
)
...
@@ -162,7 +162,7 @@ def ifbeforename(company_url):
...
@@ -162,7 +162,7 @@ def ifbeforename(company_url):
try
:
try
:
name
=
businessinfo
.
find
(
'span'
,
class_
=
'index_history-gray-tags__o8mkl'
)
.
text
name
=
businessinfo
.
find
(
'span'
,
class_
=
'index_history-gray-tags__o8mkl'
)
.
text
value
=
\
value
=
\
businessinfo
.
find
(
'span'
,
class_
=
'index_copy-text__ri7W6'
)
.
text
.
replace
(
'展开'
,
''
)
.
replace
(
' '
,
businessinfo
.
find
(
'
div'
,
class_
=
'index_history-container__VywXO'
)
.
find
(
'
span'
,
class_
=
'index_copy-text__ri7W6'
)
.
text
.
replace
(
'展开'
,
''
)
.
replace
(
' '
,
''
)
.
replace
(
''
)
.
replace
(
'…'
,
''
)
.
replace
(
'
\n
'
,
''
)
.
replace
(
'复制'
,
''
)
.
split
(
'('
)[
0
]
'…'
,
''
)
.
replace
(
'
\n
'
,
''
)
.
replace
(
'复制'
,
''
)
.
split
(
'('
)[
0
]
except
:
except
:
...
@@ -209,8 +209,11 @@ def spiderinfo(company_url, securitiesCode, securitiesShortName, listingDate, ca
...
@@ -209,8 +209,11 @@ def spiderinfo(company_url, securitiesCode, securitiesShortName, listingDate, ca
econKind
=
script
[
'companyOrgType'
]
econKind
=
script
[
'companyOrgType'
]
termStart
=
int
(
script
[
'fromTime'
])
termStart
=
int
(
script
[
'fromTime'
])
termStart
=
datetime
.
datetime
.
fromtimestamp
(
termStart
/
1000
)
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
termStart
=
datetime
.
datetime
.
fromtimestamp
(
termStart
/
1000
)
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
try
:
termEnd
=
script
[
'toTime'
]
termEnd
=
script
[
'toTime'
]
termEnd
=
datetime
.
datetime
.
fromtimestamp
(
termEnd
/
1000
)
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
termEnd
=
datetime
.
datetime
.
fromtimestamp
(
termEnd
/
1000
)
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
except
:
termEnd
=
'无固定期限'
taxpayerType
=
script
[
'taxQualification'
]
taxpayerType
=
script
[
'taxQualification'
]
subIndustry
=
script
[
'industryInfo'
][
'nameLevel3'
]
subIndustry
=
script
[
'industryInfo'
][
'nameLevel3'
]
belogOrg
=
script
[
'regInstitute'
]
belogOrg
=
script
[
'regInstitute'
]
...
@@ -275,7 +278,7 @@ def spiderinfo(company_url, securitiesCode, securitiesShortName, listingDate, ca
...
@@ -275,7 +278,7 @@ def spiderinfo(company_url, securitiesCode, securitiesShortName, listingDate, ca
if
value
==
'None'
:
if
value
==
'None'
:
aa_dic
[
key
]
=
None
aa_dic
[
key
]
=
None
# 发送kafka
# 发送kafka
#
sendkafka(aa_dic)
sendkafka
(
aa_dic
)
def
remove_parentheses
(
text
):
def
remove_parentheses
(
text
):
...
@@ -305,7 +308,7 @@ def spiderwork(soup, receptname, securitiesCode, securitiesShortName, listingDat
...
@@ -305,7 +308,7 @@ def spiderwork(soup, receptname, securitiesCode, securitiesShortName, listingDat
info_t
=
compamy
.
find
(
'div'
,
class_
=
'index_name__qEdWi'
)
info_t
=
compamy
.
find
(
'div'
,
class_
=
'index_name__qEdWi'
)
getname
=
info_t
.
find
(
'span'
)
.
text
getname
=
info_t
.
find
(
'span'
)
.
text
log
.
info
(
f
'接收到的企业名称--{receptname}---采到的企业名称--{getname}'
)
log
.
info
(
f
'接收到的企业名称--{receptname}---采到的企业名称--{getname}'
)
if
receptname
and
getname
==
receptname
:
if
receptname
and
(
getname
==
receptname
)
:
company_url
=
info_t
.
find
(
'a'
)[
'href'
]
company_url
=
info_t
.
find
(
'a'
)[
'href'
]
break
break
elif
not
receptname
:
elif
not
receptname
:
...
@@ -404,7 +407,7 @@ if __name__ == '__main__':
...
@@ -404,7 +407,7 @@ if __name__ == '__main__':
start_time
=
time
.
time
()
start_time
=
time
.
time
()
# 获取企业信息
# 获取企业信息
# company_field = baseCore.redicPullData('BaseInfoEnterprise:gnqy_socialCode')
# company_field = baseCore.redicPullData('BaseInfoEnterprise:gnqy_socialCode')
company_field
=
'|
北京华信瑞德信息技术有限公司|北京华信瑞德信息技术
有限公司|||||||||||||1|中国内地|||||||'
company_field
=
'|
江苏协昌电子科技股份有限公司|江苏协昌电子科技股份
有限公司|||||||||||||1|中国内地|||||||'
if
company_field
==
'end'
:
if
company_field
==
'end'
:
# 本轮处理完毕,需要发送邮件,并且进入下一轮
# 本轮处理完毕,需要发送邮件,并且进入下一轮
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论