Skip to content

Commit

Permalink
Unescape HTML chars in summary
Browse files Browse the repository at this point in the history
  • Loading branch information
sachaw committed Aug 24, 2021
1 parent ebcb3b9 commit 09d97f0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Contents/Code/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
from utils import requests_retry_session
import re
import base64
try:
# Python 2.6-2.7
from HTMLParser import HTMLParser
except ImportError:
# Python 3
from html.parser import HTMLParser

def update_anime(type, metadata, media, force):
result = JSON.ObjectFromString(get_anime(metadata.id))
Expand Down Expand Up @@ -51,16 +57,16 @@ def update_anime(type, metadata, media, force):
verify=certifi.where()
).content
)
# //save file
metadata.posters[anime['coverImage']['extraLarge']] = poster
except:
Log.Error('Error: Show has no posters: ' + metadata.id)

# Summary
if metadata.summary is None or force:
try:
h = HTMLParser()
cleanr = re.compile('<.*?>')
metadata.summary = re.sub(cleanr, '', anime['description'])
metadata.summary = re.sub(cleanr, '', h.unescape(anime['description']))
except:
Log.Error('Error: Show has no summary: ' + metadata.id)

Expand Down

0 comments on commit 09d97f0

Please sign in to comment.