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
d66f91ca
Commit
d66f91ca
authored
May 09, 2017
by
Renán Sosa Guillen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajustes por cambios en la página.
parent
2f7d1d20
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
noticias.py
...ios/laJornadaSanLuis/laJornadaSanLuis/spiders/noticias.py
+4
-4
noticias.pyc
...os/laJornadaSanLuis/laJornadaSanLuis/spiders/noticias.pyc
+0
-0
No files found.
otros_sitios/laJornadaSanLuis/laJornadaSanLuis/spiders/noticias.py
View file @
d66f91ca
...
@@ -35,7 +35,7 @@ class QuotesSpider(scrapy.Spider):
...
@@ -35,7 +35,7 @@ class QuotesSpider(scrapy.Spider):
def
parse
(
self
,
response
):
def
parse
(
self
,
response
):
pagination
=
response
.
xpath
(
'//div[@class="pag
ination
"]/a/@href'
)
.
extract
()
pagination
=
response
.
xpath
(
'//div[@class="pag
es
"]/a/@href'
)
.
extract
()
if
(
len
(
pagination
)
>
0
):
if
(
len
(
pagination
)
>
0
):
pagination
=
pagination
[
-
1
]
.
strip
(
'/'
)
pagination
=
pagination
[
-
1
]
.
strip
(
'/'
)
pages
=
int
(
pagination
[
pagination
.
rfind
(
'/'
)
+
1
:])
pages
=
int
(
pagination
[
pagination
.
rfind
(
'/'
)
+
1
:])
...
@@ -49,7 +49,7 @@ class QuotesSpider(scrapy.Spider):
...
@@ -49,7 +49,7 @@ class QuotesSpider(scrapy.Spider):
def
parse_page
(
self
,
response
):
def
parse_page
(
self
,
response
):
for
link
in
response
.
xpath
(
'//*[@class="post
_title"]/h3
/a/@href'
)
.
extract
():
for
link
in
response
.
xpath
(
'//*[@class="post
-title"]/h2
/a/@href'
)
.
extract
():
yield
scrapy
.
Request
(
url
=
link
,
callback
=
self
.
parse_item
)
yield
scrapy
.
Request
(
url
=
link
,
callback
=
self
.
parse_item
)
...
@@ -57,8 +57,8 @@ class QuotesSpider(scrapy.Spider):
...
@@ -57,8 +57,8 @@ class QuotesSpider(scrapy.Spider):
item
=
NoticiasItem
()
item
=
NoticiasItem
()
text
=
''
text
=
''
item
[
'date'
]
=
response
.
xpath
(
'//meta[@property="article:published_time"]/@content'
)
.
extract_first
()
item
[
'date'
]
=
response
.
xpath
(
'//meta[@property="article:published_time"]/@content'
)
.
extract_first
()
item
[
'title'
]
=
response
.
css
(
'h
2
.entry-title::text'
)
.
extract_first
()
item
[
'title'
]
=
response
.
css
(
'h
1
.entry-title::text'
)
.
extract_first
()
item
[
'topic'
]
=
response
.
xpath
(
'//
span[@class="meta-cat"]
/a/text()'
)
.
extract
()
item
[
'topic'
]
=
response
.
xpath
(
'//
ul[@class="post-categories"]/li
/a/text()'
)
.
extract
()
for
paragraph
in
response
.
xpath
(
'//p[@style="text-align: justify;"]/text()'
)
.
extract
():
for
paragraph
in
response
.
xpath
(
'//p[@style="text-align: justify;"]/text()'
)
.
extract
():
text
+=
remove_tags
(
paragraph
)
+
'
\n
'
text
+=
remove_tags
(
paragraph
)
+
'
\n
'
item
[
'text'
]
=
text
item
[
'text'
]
=
text
...
...
otros_sitios/laJornadaSanLuis/laJornadaSanLuis/spiders/noticias.pyc
View file @
d66f91ca
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