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
2919eafc
authored
May 08, 2019
by
lichenggang
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add testmart
parent
263fcee5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
plat/testmart/cate_stock.py
plat/testmart/cate_stock.py
View file @
2919eafc
from
utils.base
import
Module_Base
from
utils.base
import
Module_Base
import
re
from
utils.proxy_util
import
proxies
dom_pat
=
re
.
compile
(
r'\<script\>document\.write\(\"(.+)\"\)'
)
domain
=
'http:'
domain
=
'http:'
headers
=
{
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"
,
...
@@ -9,8 +7,8 @@ headers = {
...
@@ -9,8 +7,8 @@ headers = {
a
=
Module_Base
()
a
=
Module_Base
()
url1
=
'https://www.testmart.cn/productlist/sortpage/cat/111.html'
url1
=
'https://www.testmart.cn/productlist/sortpage/cat/111.html'
url2
=
'https://www.testmart.cn/productlist/sortpage/cat/112.html'
url2
=
'https://www.testmart.cn/productlist/sortpage/cat/112.html'
resp1
=
a
.
requests
.
get
(
url1
,
headers
=
headers
)
.
text
resp1
=
a
.
requests
.
get
(
url1
,
headers
=
headers
,
proxies
=
proxies
)
.
text
resp2
=
a
.
requests
.
get
(
url2
,
headers
=
headers
)
.
text
resp2
=
a
.
requests
.
get
(
url2
,
headers
=
headers
,
proxies
=
proxies
)
.
text
dom1
=
a
.
etree
.
HTML
(
resp1
)
dom1
=
a
.
etree
.
HTML
(
resp1
)
dom2
=
a
.
etree
.
HTML
(
resp2
)
dom2
=
a
.
etree
.
HTML
(
resp2
)
level1_doms_1_1
=
dom1
.
xpath
(
'//div[@class="left-content"]//p'
)
level1_doms_1_1
=
dom1
.
xpath
(
'//div[@class="left-content"]//p'
)
...
...
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