Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
E
esi-table-data
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esi-data-scrapping
esi-table-data
Commits
61f1ee4a
Commit
61f1ee4a
authored
Jul 05, 2017
by
Vasyl Bodnaruk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add functional for handle pagination
parent
60128423
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
aitop.py
exa/exa/spiders/aitop.py
+4
-1
mobihealthnews.py
exa/exa/spiders/mobihealthnews.py
+0
-1
No files found.
exa/exa/spiders/aitop.py
View file @
61f1ee4a
...
...
@@ -19,6 +19,9 @@ class AitopSpider(scrapy.Spider):
item
[
'description'
]
=
i
.
xpath
(
".//div[@class='summary-content']/p/text()"
)
.
extract_first
()
item
[
'url'
]
=
i
.
xpath
(
".//div[contains(@class, 'col-xs-12')]/h3/a/@href"
)
.
extract_first
()
# print(item)
has_next
=
response
.
xpath
(
".//ul[@class='pagination']//li/a/@href"
)
.
extract
()[
-
2
]
if
has_next
and
has_next
!=
'#'
:
next_url
=
'https://aitopics.org/search'
+
has_next
return
scrapy
.
Request
(
next_url
,
callback
=
self
.
parse
)
except
:
pass
exa/exa/spiders/mobihealthnews.py
View file @
61f1ee4a
...
...
@@ -57,7 +57,6 @@ class MobiHealthNewsSpider(scrapy.Spider):
"..//div[contains(@class, 'text-center')]/ul/li[contains(@class, 'next')]/a/text()"
)
.
extract_first
()
next_url
=
'http://www.mobihealthnews.com'
+
response
.
xpath
(
"..//div[contains(@class, 'text-center')]/ul/li[contains(@class, 'next')]/a/@href"
)
.
extract_first
()
print
(
has_next
,
next_url
)
if
has_next
:
yield
scrapy
.
Request
(
next_url
,
callback
=
self
.
parse
,
meta
=
{
'company'
:
response
.
meta
[
'company'
],
'post_id'
:
0
})
...
...
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