Improve stream content parsing
This commit is contained in:
parent
34d973f14e
commit
d4867b6627
1 changed files with 11 additions and 9 deletions
|
@ -37,18 +37,20 @@ def parse(obj, raw, stream):
|
||||||
obj.visual = ''
|
obj.visual = ''
|
||||||
|
|
||||||
# Collect text in nested JSON content
|
# Collect text in nested JSON content
|
||||||
if 'content' in obj.raw:
|
if 'summary' in obj.raw:
|
||||||
obj.content = obj.raw['content']
|
if 'content' in obj.raw['summary']:
|
||||||
|
obj.content = obj.raw['summary']['content']
|
||||||
|
else:
|
||||||
|
obj.content = obj.raw['summary']
|
||||||
|
elif 'content' in obj.raw:
|
||||||
|
if 'content' in obj.raw['content']:
|
||||||
|
obj.content = obj.raw['content']['content']
|
||||||
|
else:
|
||||||
|
obj.content = obj.raw['content']
|
||||||
elif 'fullContent' in obj.raw:
|
elif 'fullContent' in obj.raw:
|
||||||
obj.content = obj.raw['fullContent']
|
obj.content = obj.raw['fullContent']
|
||||||
else:
|
else:
|
||||||
if 'summary' in obj.raw:
|
obj.content = ''
|
||||||
if 'content' in obj.raw['summary']:
|
|
||||||
obj.content = obj.raw['summary']['content']
|
|
||||||
else:
|
|
||||||
obj.content = obj.raw['summary']
|
|
||||||
else:
|
|
||||||
obj.content = ''
|
|
||||||
|
|
||||||
# Detect language
|
# Detect language
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue