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
5b15cb53
Commit
5b15cb53
authored
Dec 19, 2017
by
Renán Sosa Guillen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crawl rss
parent
3cd0913c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
crawl_rss.py
crawler_script/crawl_rss.py
+15
-9
No files found.
crawler_script/crawl_rss.py
View file @
5b15cb53
...
@@ -24,13 +24,20 @@ with open(sys.argv[1]) as data_file:
...
@@ -24,13 +24,20 @@ with open(sys.argv[1]) as data_file:
except
:
except
:
print
"ok"
print
"ok"
os
.
chdir
(
media
)
os
.
chdir
(
media
)
CORRECT_YEAR
=
False
lstYears
=
os
.
listdir
(
"."
)
lstYears
.
sort
()
while
not
CORRECT_YEAR
:
year
=
desde
.
year
lstYears
=
os
.
listdir
(
"."
)
if
len
(
lstYears
)
>
0
:
lstYears
.
sort
()
year
=
int
(
lstYears
[
len
(
lstYears
)
-
1
])
year
=
desde
.
year
if
len
(
lstYears
)
>
0
:
element
=
lstYears
[
len
(
lstYears
)
-
1
]
if
element
[
-
4
:]
==
'json'
:
os
.
system
(
'rm '
+
element
)
else
:
CORRECT_YEAR
=
True
year
=
int
(
element
)
for
y
in
range
(
year
,
today
.
year
+
1
):
for
y
in
range
(
year
,
today
.
year
+
1
):
print
y
print
y
try
:
try
:
...
@@ -59,6 +66,7 @@ with open(sys.argv[1]) as data_file:
...
@@ -59,6 +66,7 @@ with open(sys.argv[1]) as data_file:
day
=
1
day
=
1
for
d
in
range
(
day
,
((
datetime
.
date
(
y
,
12
,
31
)
-
datetime
.
date
(
y
,
1
,
1
))
.
days
+
1
if
today
.
year
!=
y
else
today
.
timetuple
()
.
tm_yday
)
+
1
):
for
d
in
range
(
day
,
((
datetime
.
date
(
y
,
12
,
31
)
-
datetime
.
date
(
y
,
1
,
1
))
.
days
+
1
if
today
.
year
!=
y
else
today
.
timetuple
()
.
tm_yday
)
+
1
):
YESTERDAY
=
False
filename
=
currentDate
.
strftime
(
'
%
Y-
%
m-
%
d'
)
+
".json"
filename
=
currentDate
.
strftime
(
'
%
Y-
%
m-
%
d'
)
+
".json"
scrapycommand
=
"scrapy crawl noticias -t json --nolog -o "
+
filename
scrapycommand
=
"scrapy crawl noticias -t json --nolog -o "
+
filename
mydir
=
os
.
getcwd
()
mydir
=
os
.
getcwd
()
...
@@ -71,8 +79,6 @@ with open(sys.argv[1]) as data_file:
...
@@ -71,8 +79,6 @@ with open(sys.argv[1]) as data_file:
if
fileSize
<=
3
:
if
fileSize
<=
3
:
os
.
system
(
'rm '
+
filename
)
os
.
system
(
'rm '
+
filename
)
else
:
else
:
YESTERDAY
=
False
f1
=
mydir
+
'/'
+
filename
f1
=
mydir
+
'/'
+
filename
f2
=
filename
f2
=
filename
f3
=
baseDir
+
media
+
'/'
+
filename
f3
=
baseDir
+
media
+
'/'
+
filename
...
...
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