Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
humanities
gargantext
Commits
d49877ff
Commit
d49877ff
authored
Apr 13, 2017
by
delanoe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT][HAL CRAWLER] OK ready for tests.
parent
5de00550
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
HAL.py
gargantext/util/parsers/HAL.py
+17
-12
No files found.
gargantext/util/parsers/HAL.py
View file @
d49877ff
...
@@ -32,7 +32,8 @@ class HalParser(Parser):
...
@@ -32,7 +32,8 @@ class HalParser(Parser):
,
"authors"
:
"authFullName_s"
,
"authors"
:
"authFullName_s"
}
}
uris
=
set
()
for
doc
in
json_docs
:
for
doc
in
json_docs
:
hyperdata
=
{}
hyperdata
=
{}
...
@@ -45,6 +46,10 @@ class HalParser(Parser):
...
@@ -45,6 +46,10 @@ class HalParser(Parser):
else
:
else
:
hyperdata
[
key
]
=
field
hyperdata
[
key
]
=
field
if
hyperdata
[
"url"
]
in
uris
:
print
(
"Document already parsed"
)
else
:
uris
.
add
(
hyperdata
[
"url"
])
# hyperdata["authors"] = ", ".join(
# hyperdata["authors"] = ", ".join(
# [ p.get("person", {})
# [ p.get("person", {})
# .get("name" , "")
# .get("name" , "")
...
@@ -53,18 +58,18 @@ class HalParser(Parser):
...
@@ -53,18 +58,18 @@ class HalParser(Parser):
# ]
# ]
# )
# )
#
#
maybeDate
=
doc
.
get
(
"submittedDate_s"
,
None
)
maybeDate
=
doc
.
get
(
"submittedDate_s"
,
None
)
if
maybeDate
is
not
None
:
if
maybeDate
is
not
None
:
date
=
datetime
.
strptime
(
maybeDate
,
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
date
=
datetime
.
strptime
(
maybeDate
,
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
else
:
else
:
date
=
datetime
.
now
()
date
=
datetime
.
now
()
hyperdata
[
"publication_date"
]
=
date
hyperdata
[
"publication_date"
]
=
date
hyperdata
[
"publication_year"
]
=
str
(
date
.
year
)
hyperdata
[
"publication_year"
]
=
str
(
date
.
year
)
hyperdata
[
"publication_month"
]
=
str
(
date
.
month
)
hyperdata
[
"publication_month"
]
=
str
(
date
.
month
)
hyperdata
[
"publication_day"
]
=
str
(
date
.
day
)
hyperdata
[
"publication_day"
]
=
str
(
date
.
day
)
hyperdata_list
.
append
(
hyperdata
)
hyperdata_list
.
append
(
hyperdata
)
return
hyperdata_list
return
hyperdata_list
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