Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
crawlersNoticias
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
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
m3
crawlersNoticias
Commits
80a29bca
Commit
80a29bca
authored
Feb 01, 2018
by
Renán Sosa Guillen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crawlers
parent
a4a62474
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
4 deletions
+20
-4
noticias.py
descarga_por_dia/edoMexDia/edoMexDia/spiders/noticias.py
+14
-1
noticias.pyc
descarga_por_dia/edoMexDia/edoMexDia/spiders/noticias.pyc
+0
-0
noticias.py
descarga_por_dia/heraldoLeon/heraldoLeon/spiders/noticias.py
+6
-3
noticias.pyc
...arga_por_dia/heraldoLeon/heraldoLeon/spiders/noticias.pyc
+0
-0
No files found.
descarga_por_dia/edoMexDia/edoMexDia/spiders/noticias.py
View file @
80a29bca
...
...
@@ -45,12 +45,25 @@ class QuotesSpider(scrapy.Spider):
def
parse
(
self
,
response
):
yield
scrapy
.
Request
(
url
=
response
.
url
,
callback
=
self
.
parse_page
,
dont_filter
=
True
)
lastPage
=
response
.
xpath
(
'//div[@class="numbered-pagination"]/a[@class="pagi-last"]/@href'
)
.
extract_first
()
if
lastPage
is
None
:
lastPage
=
response
.
xpath
(
'//div[@class="numbered-pagination"]/a/@href'
)
.
extract
()[
-
1
]
if
lastPage
is
not
None
and
lastPage
!=
''
:
lastPage
=
lastPage
.
strip
(
'/'
)
lastPage
=
int
(
lastPage
[
lastPage
.
rfind
(
'/'
)
+
1
:])
for
page
in
range
(
1
,
lastPage
):
yield
scrapy
.
Request
(
url
=
self
.
baseURL
+
"/page/"
+
str
(
page
+
1
),
callback
=
self
.
parse_page
)
def
parse_page
(
self
,
response
):
for
link
in
response
.
xpath
(
'//div[@id="main"]/div/h2[@class="entry_title"]/a/@href'
)
.
extract
():
yield
scrapy
.
Request
(
url
=
link
,
callback
=
self
.
parse_item
)
nextPage
=
response
.
xpath
(
'//div[@class="numbered-pagination"]/a[@class="pagi-next"]/@href'
)
.
extract_first
()
if
nextPage
is
not
None
and
nextPage
!=
''
:
print
nextPage
yield
scrapy
.
Request
(
url
=
nextPage
,
callback
=
self
.
parse
)
...
...
descarga_por_dia/edoMexDia/edoMexDia/spiders/noticias.pyc
View file @
80a29bca
No preview for this file type
descarga_por_dia/heraldoLeon/heraldoLeon/spiders/noticias.py
View file @
80a29bca
...
...
@@ -34,11 +34,14 @@ class QuotesSpider(scrapy.Spider):
def
parse
(
self
,
response
):
yield
scrapy
.
Request
(
url
=
response
.
url
,
callback
=
self
.
parse_page
,
dont_filter
=
True
)
lastPage
=
response
.
xpath
(
'//*[@class="page-nav td-pb-padding-side"]/a[@class="last"]/text()'
)
.
extract_first
()
lastPage
=
response
.
xpath
(
'//*[@class="page-nav td-pb-padding-side"]/a[@class="last"]/@href'
)
.
extract_first
()
if
lastPage
is
None
:
lastPage
=
response
.
xpath
(
'//*[@class="page-nav td-pb-padding-side"]/a/@href'
)
.
extract
()[
-
1
]
if
lastPage
is
not
None
and
lastPage
!=
''
:
lastPage
=
int
(
lastPage
)
lastPage
=
lastPage
.
strip
(
'/'
)
lastPage
=
int
(
lastPage
[
lastPage
.
rfind
(
'/'
)
+
1
:])
for
page
in
range
(
1
,
lastPage
):
for
page
in
range
(
1
,
lastPage
):
yield
scrapy
.
Request
(
url
=
self
.
baseURL
+
"/page/"
+
str
(
page
+
1
),
callback
=
self
.
parse_page
)
...
...
descarga_por_dia/heraldoLeon/heraldoLeon/spiders/noticias.pyc
View file @
80a29bca
No preview for this file type
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