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
d895ebe3
Commit
d895ebe3
authored
Dec 08, 2017
by
Renán Sosa Guillen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crawlers
parent
3885bd5c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
137 additions
and
135 deletions
+137
-135
noticias.py
descarga_por_dia/alChile/alChile/spiders/noticias.py
+62
-62
noticias.py
...a_por_dia/desdeElBalcon/desdeElBalcon/spiders/noticias.py
+75
-73
noticias.pyc
..._por_dia/desdeElBalcon/desdeElBalcon/spiders/noticias.pyc
+0
-0
No files found.
descarga_por_dia/alChile/alChile/spiders/noticias.py
View file @
d895ebe3
import
scrapy
,
re
import
scrapy
,
re
"""
##
scrapy crawl noticias -t json --nolog -o noticias.json -a year=2017 -a month=3 -a day=22
scrapy crawl noticias -t json --nolog -o noticias.json -a year=2017 -a month=3 -a day=22
"""
TAG_RE
=
re
.
compile
(
r'<[^>]+>'
)
TAG_RE
=
re
.
compile
(
r'<[^>]+>'
)
def
remove_tags
(
text
):
def
remove_tags
(
text
):
...
...
descarga_por_dia/desdeElBalcon/desdeElBalcon/spiders/noticias.py
View file @
d895ebe3
import
scrapy
,
re
import
scrapy
,
re
from
datetime
import
datetime
,
timedelta
,
tzinfo
from
datetime
import
datetime
,
timedelta
,
tzinfo
## scrapy crawl noticias -t json --nolog -o noticias.json -a year=2017 -a month=3 -a day=22
"""
scrapy crawl noticias -t json --nolog -o noticias.json -a year=2017 -a month=3 -a day=22
"""
TAG_RE
=
re
.
compile
(
r'<[^>]+>'
)
TAG_RE
=
re
.
compile
(
r'<[^>]+>'
)
def
remove_tags
(
text
):
def
remove_tags
(
text
):
...
@@ -46,12 +48,12 @@ class QuotesSpider(scrapy.Spider):
...
@@ -46,12 +48,12 @@ class QuotesSpider(scrapy.Spider):
def
parse
(
self
,
response
):
def
parse
(
self
,
response
):
pagination
=
response
.
xpath
(
'//*[@class="pagination"]/a[@class="page-numbers"]/@href'
)
.
extract
()
pagination
=
response
.
xpath
(
'//*[@class="pagination"]/a[@class="page-numbers"]/@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
:])
for
page
in
range
(
0
,
pages
):
for
page
in
range
(
0
,
pages
):
if
(
page
==
0
)
:
if
page
==
0
:
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
)
else
:
else
:
...
...
descarga_por_dia/desdeElBalcon/desdeElBalcon/spiders/noticias.pyc
View file @
d895ebe3
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