Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lichenggang
/
update_cate
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a2b97153
authored
Jul 05, 2019
by
lichenggang
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add oneyac
parent
47cc77af
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
plat/oneyac/cate_stock.py
utils/mysqlopera.py
plat/oneyac/cate_stock.py
View file @
a2b97153
...
@@ -9,29 +9,29 @@ headers = {
...
@@ -9,29 +9,29 @@ headers = {
"user-agent"
:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36"
,
"user-agent"
:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36"
,
}
}
resp
=
a
.
requests
.
get
(
url
,
headers
=
headers
,
proxies
=
proxies
)
.
text
resp
=
a
.
requests
.
get
(
url
,
headers
=
headers
,
proxies
=
proxies
)
.
text
doms
=
a
.
etree
.
HTML
(
resp
)
doms
=
a
.
etree
.
HTML
(
resp
)
level1_1
=
doms
.
xpath
(
'//p[@class="catg-itm__cap"]//a'
)
level1_1
=
doms
.
xpath
(
'//p[@class="catg-itm__cap"]//a'
)
level1_2
=
doms
.
xpath
(
'//ul[@class="catg-sLst clear"]'
)
level1_2
=
doms
.
xpath
(
'//ul[@class="catg-sLst clear"]'
)
level1
=
zip
(
level1_1
,
level1_2
)
level1
=
zip
(
level1_1
,
level1_2
)
levels
=
[]
levels
=
[]
for
content_dom
in
level1
:
for
content_dom
in
level1
:
level1
=
dict
()
level1
=
dict
()
level1
[
'cat_name'
]
=
content_dom
[
0
]
.
xpath
(
'./text()'
)[
0
]
.
strip
()
level1
[
'cat_name'
]
=
content_dom
[
0
]
.
xpath
(
'./text()'
)[
0
]
.
strip
()
level1
[
'url'
]
=
content_dom
[
0
]
.
xpath
(
'./@href'
)[
0
]
.
strip
()
level1
[
'url'
]
=
'http://www.oneyac.com'
+
content_dom
[
0
]
.
xpath
(
'./@href'
)[
0
]
.
strip
()
level1
[
'level'
]
=
1
level1
[
'level'
]
=
1
level1
[
'islast'
]
=
0
level1
[
'islast'
]
=
0
level1
[
'parent_id'
]
=
0
level1
[
'parent_id'
]
=
0
level1
[
'level2_list'
]
=
[]
level1
[
'level2_list'
]
=
[]
print
(
'一级分类'
,
level1
[
'cat_name'
])
print
(
'一级分类'
,
level1
[
'cat_name'
])
level2_doms
=
content_dom
[
1
]
.
xpath
(
'.//li'
)
level2_doms
=
content_dom
[
1
]
.
xpath
(
'.//li'
)
for
level2_dom
in
level2_doms
:
for
level2_dom
in
level2_doms
:
level2
=
{}
level2
=
{}
level2
[
'cat_name'
]
=
level2_dom
.
xpath
(
'.//a/text()'
)[
0
]
level2
[
'cat_name'
]
=
level2_dom
.
xpath
(
'.//a/text()'
)[
0
]
level2
[
'url'
]
=
level2_dom
.
xpath
(
'.//a/@href'
)[
0
]
level2
[
'url'
]
=
'http://www.oneyac.com'
+
level2_dom
.
xpath
(
'.//a/@href'
)[
0
]
level2
[
'level'
]
=
2
level2
[
'level'
]
=
2
level2
[
'islast'
]
=
1
level2
[
'islast'
]
=
1
level1
[
'level2_list'
]
.
append
(
level2
)
level1
[
'level2_list'
]
.
append
(
level2
)
print
(
'二级分类'
,
level2
[
'cat_name'
])
print
(
'二级分类'
,
level2
[
'cat_name'
])
levels
.
append
(
level1
)
levels
.
append
(
level1
)
utils/mysqlopera.py
View file @
a2b97153
...
@@ -20,12 +20,12 @@ def get_env():
...
@@ -20,12 +20,12 @@ def get_env():
ENV
=
get_env
()
ENV
=
get_env
()
HOST_SET
=
{
HOST_SET
=
{
'test'
:
'192.168.
1.234
'
,
'test'
:
'192.168.
2.232
'
,
'test234'
:
'192.168.1.234'
,
'test234'
:
'192.168.1.234'
,
'produce'
:
'172.18.137.37'
'produce'
:
'172.18.137.37'
}
}
UP_SET
=
{
UP_SET
=
{
'test'
:
(
'
ichunt'
,
'ichunt
'
),
'test'
:
(
'
oneyac'
,
'oneyac#zsyM
'
),
'produce'
:
(
'bigdata'
,
'bdYm2yy2mmyzlmlly'
)
'produce'
:
(
'bigdata'
,
'bdYm2yy2mmyzlmlly'
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment