mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-21 15:36:18 -05:00
Handling rare error when parsing articles.
Some checks are pending
CodeQL / Analyze (push) Waiting to run
Some checks are pending
CodeQL / Analyze (push) Waiting to run
This commit is contained in:
parent
e8b8eb84a9
commit
76b9ead174
1 changed files with 1 additions and 1 deletions
|
|
@ -319,7 +319,7 @@ def parse_article_html_metadata(html: Union[bytes, str], assume_utc: bool = True
|
|||
except json.decoder.JSONDecodeError:
|
||||
# Was not valid JSON.
|
||||
schema = None
|
||||
if isinstance(schema, dict) and '://schema.org' in schema.get('@context'):
|
||||
if isinstance(schema, dict) and (context := schema.get('@context')) and '://schema.org' in context:
|
||||
# Found https://schema.org/
|
||||
if headline := schema.get('headline'):
|
||||
metadata.title = metadata.title or headline
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue