aboutsummaryrefslogtreecommitdiffstats
path: root/python/sandcrawler/ingest.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-11-03 22:40:14 -0800
committerBryan Newbold <bnewbold@archive.org>2020-11-03 22:40:14 -0800
commit653fac9632c6ae9dd036ad844454cf419cd5320b (patch)
treec09d8a3d8a2524a991f082ab500bce53d1986caa /python/sandcrawler/ingest.py
parent9beafd7c5fc98571ec26b49d223ce660378d7b9e (diff)
downloadsandcrawler-653fac9632c6ae9dd036ad844454cf419cd5320b.tar.gz
sandcrawler-653fac9632c6ae9dd036ad844454cf419cd5320b.zip
xml: re-encode XML docs into UTF-8 for persisting
Diffstat (limited to 'python/sandcrawler/ingest.py')
-rw-r--r--python/sandcrawler/ingest.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/python/sandcrawler/ingest.py b/python/sandcrawler/ingest.py
index 1a42b6a..363485e 100644
--- a/python/sandcrawler/ingest.py
+++ b/python/sandcrawler/ingest.py
@@ -18,6 +18,7 @@ from sandcrawler.html import extract_fulltext_url
from sandcrawler.html_metadata import html_extract_fulltext_url, XML_FULLTEXT_PATTERNS
from sandcrawler.workers import SandcrawlerWorker
from sandcrawler.db import SandcrawlerPostgrestClient
+from sandcrawler.xml import xml_reserialize
class IngestFileWorker(SandcrawlerWorker):
@@ -316,10 +317,11 @@ class IngestFileWorker(SandcrawlerWorker):
count), or attempting to fetch sub-resources.
"""
if self.xmldoc_sink and file_meta['mimetype'] == "application/jats+xml":
+ jats_xml = xml_reserialize(resource.body)
msg = dict(
sha1hex=file_meta["sha1hex"],
status="success",
- jats_xml=resource.body.encode('utf-8'),
+ jats_xml=jats_xml,
)
self.xmldoc_sink.push_record(msg, key=file_meta['sha1hex'])
return dict(status="success")