escape strings

This commit is contained in:
j 2024-09-11 22:52:01 +01:00
commit 41edea1862
20 changed files with 74 additions and 74 deletions

View file

@ -24,8 +24,8 @@ def get_data(url):
r = {}
r['title'] = find_re(data, '<h1 class="movie_title">(.*?)</h1>')
if '(' in r['title']:
r['year'] = find_re(r['title'], '\((\d*?)\)')
r['title'] = strip_tags(re.sub('\((\d*?)\)', '', r['title'])).strip()
r['year'] = find_re(r['title'], r'\((\d*?)\)')
r['title'] = strip_tags(re.sub(r'\((\d*?)\)', '', r['title'])).strip()
r['summary'] = strip_tags(find_re(data, '<p id="movieSynopsis" class="movie_synopsis" itemprop="description">(.*?)</p>')).strip()
r['summary'] = r['summary'].replace('\t', ' ').replace('\n', ' ').replace(' ', ' ').replace(' ', ' ')
if not r['summary']:
@ -35,9 +35,9 @@ def get_data(url):
meter = [m for m in meter if m[1].isdigit()]
if meter:
r['tomatometer'] = meter[0][1]
r['rating'] = find_re(data, 'Average Rating: <span>([\d.]+)/10</span>')
r['user_score'] = find_re(data, '<span class="meter popcorn numeric ">(\d+)</span>')
r['user_rating'] = find_re(data, 'Average Rating: ([\d.]+)/5')
r['rating'] = find_re(data, r'Average Rating: <span>([\d.]+)/10</span>')
r['user_score'] = find_re(data, r'<span class="meter popcorn numeric ">(\d+)</span>')
r['user_rating'] = find_re(data, r'Average Rating: ([\d.]+)/5')
poster = get_og(data, 'image')
if poster and not 'poster_default.gif' in poster:
r['posters'] = [poster]