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
dd06c629
Commit
dd06c629
authored
Jan 29, 2018
by
Renán Sosa Guillen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crawlers
parent
d835cdfc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
6 deletions
+20
-6
pipelines.pyc
descarga_por_dia/heraldoAgs/heraldoAgs/pipelines.pyc
+0
-0
noticias.pyc
descarga_por_dia/heraldoAgs/heraldoAgs/spiders/noticias.pyc
+0
-0
noticias.py
descarga_por_dia/laRazon/laRazon/spiders/noticias.py
+20
-6
noticias.pyc
descarga_por_dia/laRazon/laRazon/spiders/noticias.pyc
+0
-0
No files found.
descarga_por_dia/heraldoAgs/heraldoAgs/pipelines.pyc
View file @
dd06c629
No preview for this file type
descarga_por_dia/heraldoAgs/heraldoAgs/spiders/noticias.pyc
View file @
dd06c629
No preview for this file type
descarga_por_dia/laRazon/laRazon/spiders/noticias.py
View file @
dd06c629
...
@@ -31,11 +31,13 @@ class QuotesSpider(scrapy.Spider):
...
@@ -31,11 +31,13 @@ class QuotesSpider(scrapy.Spider):
def
parse
(
self
,
response
):
def
parse
(
self
,
response
):
yield
scrapy
.
Request
(
url
=
response
.
url
,
callback
=
self
.
parse_page
,
dont_filter
=
True
)
yield
scrapy
.
Request
(
url
=
response
.
url
,
callback
=
self
.
parse_page
,
dont_filter
=
True
)
pagination
=
response
.
xpath
(
'//*[@class="page-nav td-pb-padding-side"]/a[@class="last"]/@href'
)
.
extract_first
()
pagination
=
response
.
xpath
(
'//*[@class="page-nav td-pb-padding-side"]/a/@href'
)
.
extract
()
pagination
=
pagination
.
strip
(
'/'
)
if
len
(
pagination
)
>
0
:
pages
=
int
(
pagination
[
pagination
.
rfind
(
'/'
)
+
1
:])
pagination
=
pagination
[
-
2
]
.
strip
(
'/'
)
for
page
in
range
(
1
,
pages
):
pages
=
int
(
pagination
[
pagination
.
rfind
(
'/'
)
+
1
:])
yield
scrapy
.
Request
(
url
=
self
.
baseURL
+
'/page/'
+
str
(
page
+
1
),
callback
=
self
.
parse_page
)
for
page
in
range
(
1
,
pages
):
yield
scrapy
.
Request
(
url
=
self
.
baseURL
+
"/page/"
+
str
(
page
+
1
),
callback
=
self
.
parse_page
)
def
parse_page
(
self
,
response
):
def
parse_page
(
self
,
response
):
...
@@ -53,12 +55,24 @@ class QuotesSpider(scrapy.Spider):
...
@@ -53,12 +55,24 @@ class QuotesSpider(scrapy.Spider):
d
=
d
[:
-
6
]
+
'-06:00'
d
=
d
[:
-
6
]
+
'-06:00'
item
[
'date'
]
=
d
item
[
'date'
]
=
d
item
[
'topic'
]
=
response
.
xpath
(
'//*[@class="entry-crumbs"]/span/a[@class="entry-crumb"]/text()'
)
.
extract
()[
2
]
try
:
topic
=
response
.
xpath
(
'//*[@class="entry-crumbs"]/span/a[@class="entry-crumb"]/text()'
)
.
extract
()[
2
]
except
:
try
:
topic
=
response
.
xpath
(
'//*[@class="entry-crumbs"]/span/a[@class="entry-crumb"]/text()'
)
.
extract
()[
1
]
except
:
topic
=
response
.
xpath
(
'//*[@class="entry-crumbs"]/span/a[@class="entry-crumb"]/text()'
)
.
extract_first
()
item
[
'topic'
]
=
topic
ti
=
response
.
xpath
(
'//*[@class="td-post-header"]/header/h1/text()'
)
.
extract_first
()
ti
=
response
.
xpath
(
'//*[@class="td-post-header"]/header/h1/text()'
)
.
extract_first
()
if
ti
is
None
:
if
ti
is
None
:
ti
=
response
.
xpath
(
'//header[@class="td-post-title"]/h1/text()'
)
.
extract_first
()
ti
=
response
.
xpath
(
'//header[@class="td-post-title"]/h1/text()'
)
.
extract_first
()
item
[
'title'
]
=
ti
item
[
'title'
]
=
ti
author
=
response
.
xpath
(
'//div[@class="td-post-author-name"]/a/text()'
)
.
extract_first
()
if
author
is
not
None
:
item
[
'author'
]
=
author
paragraphs
=
response
.
xpath
(
'//*[@class="td-post-content"]/p'
)
.
extract
()
paragraphs
=
response
.
xpath
(
'//*[@class="td-post-content"]/p'
)
.
extract
()
if
len
(
paragraphs
)
<=
0
:
if
len
(
paragraphs
)
<=
0
:
paragraphs
=
response
.
xpath
(
'//*[@dir="auto"]'
)
.
extract
()
paragraphs
=
response
.
xpath
(
'//*[@dir="auto"]'
)
.
extract
()
...
...
descarga_por_dia/laRazon/laRazon/spiders/noticias.pyc
View file @
dd06c629
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