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
3b34158e
Commit
3b34158e
authored
May 24, 2016
by
delanoe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[BUG FIX] Some files errors for HTML/LXML (without any log errors).
parent
75a7e329
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
Europress.py
gargantext/util/parsers/Europress.py
+9
-6
No files found.
gargantext/util/parsers/Europress.py
View file @
3b34158e
...
@@ -62,12 +62,15 @@ class EuropressParser(Parser):
...
@@ -62,12 +62,15 @@ class EuropressParser(Parser):
except
:
except
:
ValueError
(
'Error while decoding from "latin1" to "
%
s"'
%
encoding
)
ValueError
(
'Error while decoding from "latin1" to "
%
s"'
%
encoding
)
html_parser
=
etree
.
HTMLParser
(
encoding
=
codif
)
try
:
html
=
etree
.
fromstring
(
contents
,
html_parser
)
html_parser
=
etree
.
HTMLParser
(
encoding
=
codif
)
html
=
etree
.
fromstring
(
contents
,
html_parser
)
html_parser
=
html5parser
.
etree
.
HTMLParser
(
encoding
=
codif
)
html_parser
=
html5parser
.
etree
.
HTMLParser
(
encoding
=
codif
)
html
=
html5parser
.
etree
.
fromstring
(
contents
,
html_parser
)
html
=
html5parser
.
etree
.
fromstring
(
contents
,
html_parser
)
html_articles
=
html
.
xpath
(
'//article'
)
html_articles
=
html
.
xpath
(
'//article'
)
except
Exception
as
error
:
print
(
"Europresse lxml error:"
,
error
)
# all except detail_header are mandatory to parse the article
# all except detail_header are mandatory to parse the article
name_xpath
=
"./header/div/span[@class = 'DocPublicationName']"
name_xpath
=
"./header/div/span[@class = 'DocPublicationName']"
...
@@ -261,7 +264,7 @@ class EuropressParser(Parser):
...
@@ -261,7 +264,7 @@ class EuropressParser(Parser):
yield
hyperdata
yield
hyperdata
except
:
except
:
raise
Exception
(
'Something bad happened.'
)
print
(
'Something bad happened.'
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
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