feat: genius fixes and duplicate detection
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import json
|
||||
import simplejson as json
|
||||
from json_unescape import escape_json, unescape_json
|
||||
from enum import Enum
|
||||
from typing import List, Optional, Type
|
||||
from urllib.parse import urlencode, urlparse, urlunparse
|
||||
@@ -268,8 +269,9 @@ class Genius(Page):
|
||||
# get the contents that are between `JSON.parse('` and `');`
|
||||
content = self.get_json_content_from_response(r, start="window.__PRELOADED_STATE__ = JSON.parse('", end="');\n window.__APP_CONFIG__ = ")
|
||||
if content is not None:
|
||||
content = content.replace("\\\\", "\\").replace('\\"', '"').replace("\\'", "'")
|
||||
data = json.loads(content)
|
||||
#IMPLEMENT FIX FROM HAZEL
|
||||
content = escape_json(content)
|
||||
data = json.loads(content)
|
||||
|
||||
lyrics_html = traverse_json_path(data, "songPage.lyricsData.body.html", default=None)
|
||||
if lyrics_html is not None:
|
||||
|
||||
Reference in New Issue
Block a user