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
58d686cc
Commit
58d686cc
authored
Jan 31, 2018
by
Renán Sosa Guillen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crawlers
parent
f3e69d86
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
4 deletions
+14
-4
pipelines.pyc
descarga_por_dia/diarioYaqui/diarioYaqui/pipelines.pyc
+0
-0
noticias.pyc
...arga_por_dia/diarioYaqui/diarioYaqui/spiders/noticias.pyc
+0
-0
pipelines.pyc
descarga_por_dia/grilloPorteno/grilloPorteno/pipelines.pyc
+0
-0
noticias.pyc
..._por_dia/grilloPorteno/grilloPorteno/spiders/noticias.pyc
+0
-0
noticias.py
...por_dia/yucatanALaMano/yucatanALaMano/spiders/noticias.py
+14
-4
noticias.pyc
...or_dia/yucatanALaMano/yucatanALaMano/spiders/noticias.pyc
+0
-0
No files found.
descarga_por_dia/diarioYaqui/diarioYaqui/pipelines.pyc
View file @
58d686cc
No preview for this file type
descarga_por_dia/diarioYaqui/diarioYaqui/spiders/noticias.pyc
View file @
58d686cc
No preview for this file type
descarga_por_dia/grilloPorteno/grilloPorteno/pipelines.pyc
View file @
58d686cc
No preview for this file type
descarga_por_dia/grilloPorteno/grilloPorteno/spiders/noticias.pyc
View file @
58d686cc
No preview for this file type
descarga_por_dia/yucatanALaMano/yucatanALaMano/spiders/noticias.py
View file @
58d686cc
...
...
@@ -22,9 +22,13 @@ class QuotesSpider(scrapy.Spider):
month
=
getattr
(
self
,
'month'
,
None
)
day
=
getattr
(
self
,
'day'
,
None
)
self
.
baseURL
=
"http://www.yucatanalamano.com/"
+
year
+
"/"
+
month
+
"/"
+
day
# self.baseURL = "http://www.yucatanalamano.com/" + year + "/" + month + "/" + day
# self.baseURL = "http://yucatanalamano.com/" + year + "/" + month + "/" + day
urlList
=
[
"http://www.yucatanalamano.com/"
+
year
+
"/"
+
month
+
"/"
+
day
,
"http://yucatanalamano.com/"
+
year
+
"/"
+
month
+
"/"
+
day
]
yield
scrapy
.
Request
(
url
=
self
.
baseURL
,
callback
=
self
.
parse
)
for
url
in
urlList
:
yield
scrapy
.
Request
(
url
=
url
,
callback
=
self
.
parse
)
def
parse
(
self
,
response
):
...
...
@@ -36,7 +40,7 @@ class QuotesSpider(scrapy.Spider):
pages
=
int
(
pagination
[
pagination
.
rfind
(
'/'
)
+
1
:])
for
page
in
range
(
1
,
pages
):
yield
scrapy
.
Request
(
url
=
self
.
baseURL
+
"/page/"
+
str
(
page
+
1
),
callback
=
self
.
parse_page
)
yield
scrapy
.
Request
(
url
=
response
.
url
+
"/page/"
+
str
(
page
+
1
),
callback
=
self
.
parse_page
)
def
parse_page
(
self
,
response
):
...
...
@@ -47,7 +51,13 @@ class QuotesSpider(scrapy.Spider):
def
parse_item
(
self
,
response
):
item
=
NoticiasItem
()
text
=
''
item
[
'title'
]
=
response
.
css
(
'div.main_container'
)
.
css
(
'h1.post-tile::text'
)
.
extract_first
()
title
=
response
.
xpath
(
'//div[@class="main-col"]/div[@itemprop="name"]/text()'
)
.
extract_first
()
if
title
is
None
:
title
=
response
.
xpath
(
'//div[@class="main-col"]'
)
.
css
(
'h1'
)
.
extract_first
()
if
title
is
not
None
:
item
[
'title'
]
=
remove_tags
(
title
)
else
:
item
[
'title'
]
=
title
d
=
response
.
css
(
'div.mom-post-meta'
)
.
css
(
'span'
)
.
css
(
'time::attr(datetime)'
)
.
extract_first
()
## '-06:00' corresponde al UTC-6, zona horaria de yucatan (centro de mexico)
...
...
descarga_por_dia/yucatanALaMano/yucatanALaMano/spiders/noticias.pyc
View file @
58d686cc
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