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
4b47955a
Commit
4b47955a
authored
Aug 26, 2016
by
c24b
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DEBUG mode for EUROPRESSE + RIS
parent
56843d67
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
5 deletions
+4
-5
EUROPRESSE.py
gargantext/util/parsers/EUROPRESSE.py
+3
-4
RIS.py
gargantext/util/parsers/RIS.py
+1
-1
No files found.
gargantext/util/parsers/EUROPRESSE.py
View file @
4b47955a
...
@@ -32,7 +32,6 @@ from ._Parser import Parser
...
@@ -32,7 +32,6 @@ from ._Parser import Parser
class
EuropresseParser
(
Parser
):
class
EuropresseParser
(
Parser
):
def
parse
(
self
,
file
):
def
parse
(
self
,
file
):
#print("europr_parser file", file)
localeEncoding
=
"fr_FR"
localeEncoding
=
"fr_FR"
codif
=
"UTF-8"
codif
=
"UTF-8"
...
@@ -55,7 +54,7 @@ class EuropresseParser(Parser):
...
@@ -55,7 +54,7 @@ class EuropresseParser(Parser):
contents
=
file
.
read
()
contents
=
file
.
read
()
encoding
=
self
.
detect_encoding
(
contents
)
encoding
=
self
.
detect_encoding
(
contents
)
#print(encoding)
if
encoding
!=
"utf-8"
:
if
encoding
!=
"utf-8"
:
try
:
try
:
contents
=
contents
.
decode
(
"latin1"
,
errors
=
'replace'
)
.
encode
(
codif
)
contents
=
contents
.
decode
(
"latin1"
,
errors
=
'replace'
)
.
encode
(
codif
)
...
@@ -116,7 +115,7 @@ class EuropresseParser(Parser):
...
@@ -116,7 +115,7 @@ class EuropresseParser(Parser):
try
:
try
:
for
html_article
in
html_articles
:
for
html_article
in
html_articles
:
#
print("==============================new article")
print
(
"==============================new article"
)
# s'il n'y a pas du tout de header on doit skip
# s'il n'y a pas du tout de header on doit skip
all_header
=
html_article
.
xpath
(
entire_header_xpath
)
all_header
=
html_article
.
xpath
(
entire_header_xpath
)
...
@@ -261,7 +260,7 @@ class EuropresseParser(Parser):
...
@@ -261,7 +260,7 @@ class EuropresseParser(Parser):
# most probably news_topic before beginning of date
# most probably news_topic before beginning of date
hyperdata
[
'rubrique'
]
=
header_elts
[
0
]
hyperdata
[
'rubrique'
]
=
header_elts
[
0
]
print
(
hyperdata
)
yield
hyperdata
yield
hyperdata
except
:
except
:
...
...
gargantext/util/parsers/RIS.py
View file @
4b47955a
...
@@ -30,7 +30,7 @@ class RISParser(Parser):
...
@@ -30,7 +30,7 @@ class RISParser(Parser):
}
}
def
parse
(
self
,
file
):
def
parse
(
self
,
file
):
print
(
"=====> PARSING RIS"
)
print
(
"=====> PARSING RIS"
,
file
)
hyperdata
=
{}
hyperdata
=
{}
last_key
=
None
last_key
=
None
last_values
=
[]
last_values
=
[]
...
...
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