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
4f6893f0
authored
May 13, 2019
by
lichenggang
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add taojindi
parent
bf3f6ad4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
1 deletions
plat/taojindi/__init__.py
plat/taojindi/cate_stock.py
utils/mysqlopera.py
plat/taojindi/__init__.py
0 → 100644
View file @
4f6893f0
File mode changed
plat/taojindi/cate_stock.py
0 → 100644
View file @
4f6893f0
from
utils.base
import
Module_Base
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"
,
}
a
=
Module_Base
()
url
=
'http://search.taojindi.com/list/product_
%
E7
%94%
B5
%
E5
%
AD
%90%
E6
%9
D
%90%
E6
%96%99%
E3
%80%81%
E9
%9
B
%
B6
%
E9
%83%
A8
%
E4
%
BB
%
B6/'
resp
=
a
.
requests
.
get
(
url
,
headers
=
headers
)
.
text
dom
=
a
.
etree
.
HTML
(
resp
)
level1_doms
=
dom
.
xpath
(
'//ul[@class="navlist"]//li[@class="m-list"]'
)
levels
=
[]
level1
=
{}
level1
[
'cat_name'
]
=
'电子材料、零部件'
level1
[
'url'
]
=
'http://search.taojindi.com/list/product_
%
E7
%94%
B5
%
E5
%
AD
%90%
E6
%9
D
%90%
E6
%96%99%
E3
%80%81%
E9
%9
B
%
B6
%
E9
%83%
A8
%
E4
%
BB
%
B6/'
level1
[
'level'
]
=
1
level1
[
'islast'
]
=
0
level1
[
'parent_id'
]
=
0
level1
[
'level2_list'
]
=
[]
# print('一级分类',level1)
level2_doms
=
dom
.
xpath
(
'//ul[@class="clearfix"]/li/a'
)
for
level2_dom
in
level2_doms
:
level2
=
{}
level2
[
'cat_name'
]
=
level2_dom
.
xpath
(
'./text()'
)[
0
]
level2
[
'url'
]
=
level2_dom
.
xpath
(
'./@href'
)[
0
]
level2
[
'level'
]
=
2
level2
[
'islast'
]
=
1
level1
[
'level2_list'
]
.
append
(
level2
)
# print('二级分类',level2)
levels
.
append
(
level1
)
print
(
levels
)
\ No newline at end of file
utils/mysqlopera.py
View file @
4f6893f0
...
@@ -6,7 +6,8 @@ import time
...
@@ -6,7 +6,8 @@ import time
import
pymysql
import
pymysql
COMPANY_PN_LIST
=
[
'hc360'
,
'huangye88'
,
'pangwo'
,
'coovee'
,
'liebiao'
,
'china'
,
'ic114'
,
'cecb2b'
,
'trustexporter'
,
COMPANY_PN_LIST
=
[
'hc360'
,
'huangye88'
,
'pangwo'
,
'coovee'
,
'liebiao'
,
'china'
,
'ic114'
,
'cecb2b'
,
'trustexporter'
,
'x11467'
,
'x912688'
,
'zgtghccl'
,
'herostart'
,
'testmart'
,
'cc'
,
'eastsoo'
,
'x51sole'
,
'eb80'
,
'x258'
]
'x11467'
,
'x912688'
,
'zgtghccl'
,
'herostart'
,
'testmart'
,
'cc'
,
'eastsoo'
,
'x51sole'
,
'eb80'
,
'x258'
,
'taojindi'
]
def
get_env
():
def
get_env
():
...
...
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