Added mobile user-agent (less blocking)

This commit is contained in:
2020-12-19 10:28:53 +01:00
parent 7d2015a249
commit e2201ded4a
2 changed files with 5 additions and 4 deletions

View File

@@ -16,7 +16,7 @@ class Genius {
})
}
get_lyrics(song_id, callback) {
get_lyrics(song_id, use_mobile, callback) {
axios({
method: "get",
url: "https://api.genius.com/songs/" + song_id,
@@ -24,7 +24,8 @@ class Genius {
}).then(response => {
axios({
method: "get",
url: response.data.response.song.url
url: response.data.response.song.url,
headers: { "User-Agent": use_mobile ? "Mozilla/5.0 (Linux; Android 6.0.1; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Mobile Safari/537.36" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" }
}).then(response => {
const texts = $("div.lyrics > p", response.data)["0"].children;
let lyrics;