diff --git a/server/providers/Audible.js b/server/providers/Audible.js index 4651684c..2f369937 100644 --- a/server/providers/Audible.js +++ b/server/providers/Audible.js @@ -39,8 +39,12 @@ class Audible { } asinSearch(asin) { - var queryString = `response_groups=rating,series,contributors,product_desc,media,product_extended_attrs` + - `&image_sizes=500,1024,2000`; + var queryObj = { + response_groups: 'rating,series,contributors,product_desc,media,product_extended_attrs', + image_sizes: '500,1024,2000' + }; + var queryString = (new URLSearchParams(queryObj)).toString(); + asin = encodeURIComponent(asin); var url = `https://api.audible.com/1.0/catalog/products/${asin}?${queryString}` Logger.debug(`[Audible] ASIN url: ${url}`) return axios.get(url).then((res) => { diff --git a/server/providers/Audnexus.js b/server/providers/Audnexus.js index a7d76f67..4d9c4ce2 100644 --- a/server/providers/Audnexus.js +++ b/server/providers/Audnexus.js @@ -8,6 +8,7 @@ class Audnexus { } authorASINsRequest(name) { + name = encodeURIComponent(name); return axios.get(`${this.baseUrl}/authors?name=${name}`).then((res) => { return res.data || [] }).catch((error) => { @@ -17,6 +18,7 @@ class Audnexus { } authorRequest(asin) { + asin = encodeURIComponent(asin); return axios.get(`${this.baseUrl}/authors/${asin}`).then((res) => { return res.data }).catch((error) => { diff --git a/server/providers/GoogleBooks.js b/server/providers/GoogleBooks.js index 43bdf719..0da3c309 100644 --- a/server/providers/GoogleBooks.js +++ b/server/providers/GoogleBooks.js @@ -32,8 +32,12 @@ class GoogleBooks { } async search(title, author) { + title = encodeURIComponent(title) var queryString = `q=intitle:${title}` - if (author) queryString += `+inauthor:${author}` + if (author) { + author = encodeURIComponent(author) + queryString += `+inauthor:${author}` + } var url = `https://www.googleapis.com/books/v1/volumes?${queryString}` Logger.debug(`[GoogleBooks] Search url: ${url}`) var items = await axios.get(url).then((res) => { diff --git a/server/providers/LibGen.js b/server/providers/LibGen.js index 87d119b0..6b01436d 100644 --- a/server/providers/LibGen.js +++ b/server/providers/LibGen.js @@ -15,6 +15,7 @@ class LibGen { await this.init() } queryTitle = queryTitle.replace(/'/g, '') + queryTitle = encodeURIComponent(queryTitle); var options = { mirror: this.mirror, query: queryTitle, diff --git a/server/providers/OpenLibrary.js b/server/providers/OpenLibrary.js index 6694005e..3f4d4682 100644 --- a/server/providers/OpenLibrary.js +++ b/server/providers/OpenLibrary.js @@ -85,7 +85,7 @@ class OpenLibrary { } async searchTitle(title) { - title = title.replace(/'/g, '') + title = encodeURIComponent(title); var lookupData = await this.get(`/search.json?title=${title}`) if (!lookupData) { return {