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
077afd63
Commit
077afd63
authored
Sep 18, 2017
by
Renán Sosa Guillen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
date classifier
parent
2175e603
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
parse_date_files.py
parse_date_files.py
+5
-1
No files found.
parse_date_files.py
View file @
077afd63
...
@@ -10,7 +10,7 @@ python parse_date_files.py laJornadaBC2
...
@@ -10,7 +10,7 @@ python parse_date_files.py laJornadaBC2
"""
"""
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
+
'/
crawlersNoticias/
descarga_hacia_atras/'
+
sys
.
argv
[
1
]
json_file_path
=
this_file_path
+
'/descarga_hacia_atras/'
+
sys
.
argv
[
1
]
destination_path
=
this_file_path
+
'/'
+
sys
.
argv
[
1
]
destination_path
=
this_file_path
+
'/'
+
sys
.
argv
[
1
]
json_file
=
json
.
loads
(
open
(
json_file_path
+
'/noticias.json'
)
.
read
())
json_file
=
json
.
loads
(
open
(
json_file_path
+
'/noticias.json'
)
.
read
())
...
@@ -19,6 +19,8 @@ date_set = set()
...
@@ -19,6 +19,8 @@ date_set = set()
for
news
in
json_file
:
for
news
in
json_file
:
if
news
[
'date'
]
is
not
None
:
if
news
[
'date'
]
is
not
None
:
news_date
=
news
[
'date'
][:
news
[
'date'
]
.
rfind
(
'T'
)]
news_date
=
news
[
'date'
][:
news
[
'date'
]
.
rfind
(
'T'
)]
if
len
(
news_date
)
>
10
:
news_date
=
news
[
'date'
][:
news
[
'date'
]
.
rfind
(
' '
)]
if
not
news_date
in
date_set
:
if
not
news_date
in
date_set
:
date_set
.
add
(
news_date
)
date_set
.
add
(
news_date
)
...
@@ -36,6 +38,8 @@ for news in json_file:
...
@@ -36,6 +38,8 @@ for news in json_file:
for
line
in
json_file
:
for
line
in
json_file
:
if
line
[
'date'
]
is
not
None
:
if
line
[
'date'
]
is
not
None
:
line_date
=
line
[
'date'
][:
line
[
'date'
]
.
rfind
(
'T'
)]
line_date
=
line
[
'date'
][:
line
[
'date'
]
.
rfind
(
'T'
)]
if
len
(
line_date
)
>
10
:
line_date
=
line
[
'date'
][:
line
[
'date'
]
.
rfind
(
' '
)]
if
line_date
==
news_date
:
if
line_date
==
news_date
:
counter
+=
1
counter
+=
1
...
...
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