mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-12 22:25:44 -04:00
Handle list of tags in JSON, and be more clever about comma vs. space
This commit is contained in:
parent
178e676e0f
commit
ccabda4c7d
3 changed files with 21 additions and 4 deletions
|
@ -66,9 +66,14 @@ def parse_generic_json_export(json_file: IO[str], **_kwargs) -> Iterable[Link]:
|
|||
elif link.get('name'):
|
||||
title = link['name'].strip()
|
||||
|
||||
tags = ''
|
||||
if link.get('tags'):
|
||||
tags = link.get('tags').replace(' ',',')
|
||||
# if we have a list, join it with commas
|
||||
tags = link.get('tags')
|
||||
if type(tags) == list:
|
||||
tags = ','.join(tags)
|
||||
elif type(tags) == str:
|
||||
# if there's no comma, assume it was space-separated
|
||||
if ',' not in tags:
|
||||
tags = tags.replace(' ', ',')
|
||||
|
||||
yield Link(
|
||||
url=htmldecode(url),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue