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
58a9b455
Commit
58a9b455
authored
Apr 02, 2018
by
Renán Sosa Guillen
Browse files
Options
Browse Files
Download
Plain Diff
merge foraneos
parents
589f0472
f7f6bcc7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
crawl_backwards.py
crawler_script/crawl_backwards.py
+1
-1
parse_date_files.py
parse_date_files.py
+4
-3
No files found.
crawler_script/crawl_backwards.py
View file @
58a9b455
...
@@ -62,7 +62,7 @@ with open(sys.argv[1]) as data_file:
...
@@ -62,7 +62,7 @@ with open(sys.argv[1]) as data_file:
if
fileSize
<=
3
:
os
.
system
(
"rm "
+
filename
)
if
fileSize
<=
3
:
os
.
system
(
"rm "
+
filename
)
else
:
else
:
os
.
chdir
(
scrapyDir
)
os
.
chdir
(
scrapyDir
)
os
.
system
(
"python3 parse_date_files.py "
+
s
[
'crawler'
])
os
.
system
(
"python3 parse_date_files.py "
+
s
[
'crawler'
]
+
" "
+
filename
)
os
.
chdir
(
media
)
os
.
chdir
(
media
)
mediaYears
=
os
.
listdir
(
"."
)
mediaYears
=
os
.
listdir
(
"."
)
mediaYears
.
sort
()
mediaYears
.
sort
()
...
...
parse_date_files.py
View file @
58a9b455
...
@@ -4,10 +4,10 @@ from collections import OrderedDict
...
@@ -4,10 +4,10 @@ from collections import OrderedDict
"""
"""
Uso:
Uso:
python parse_date_files.py <
nombre_del_crawler
>
python parse_date_files.py <
ruta_del_crawler> <nombre_archivo
>
Ej.
Ej.
python parse_date_files.py descarga_hacia_atras/laJornadaBC2
python parse_date_files.py descarga_hacia_atras/laJornadaBC2
noticias.json
"""
"""
def
dictRowGenerator
(
line
):
def
dictRowGenerator
(
line
):
...
@@ -46,13 +46,14 @@ def dictRowGenerator(line):
...
@@ -46,13 +46,14 @@ def dictRowGenerator(line):
info
=
sys
.
argv
[
1
]
info
=
sys
.
argv
[
1
]
news_file
=
sys
.
argv
[
2
]
media
=
info
[
info
.
rfind
(
"/"
)
+
1
:]
media
=
info
[
info
.
rfind
(
"/"
)
+
1
:]
download_type
=
info
[:
info
.
rfind
(
"/"
)]
download_type
=
info
[:
info
.
rfind
(
"/"
)]
this_file_path
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
this_file_path
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
json_file_path
=
this_file_path
+
"/"
+
download_type
+
"/"
+
media
json_file_path
=
this_file_path
+
"/"
+
download_type
+
"/"
+
media
destination_path
=
this_file_path
+
"/"
+
media
destination_path
=
this_file_path
+
"/"
+
media
json_file
=
json
.
loads
(
open
(
json_file_path
+
"/
noticias.json"
)
.
read
())
json_file
=
json
.
loads
(
open
(
json_file_path
+
"/
"
+
news_file
)
.
read
())
date_set
=
set
()
date_set
=
set
()
for
news
in
json_file
:
for
news
in
json_file
:
...
...
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