bump google-sr

This commit is contained in:
TheBeastLT
2022-03-02 15:01:59 +01:00
parent 47c05c465c
commit 5100751c19
3 changed files with 55 additions and 30 deletions

77
package-lock.json generated
View File

@@ -18,7 +18,7 @@
"cheerio": "^0.22.0",
"express": "^4.16.4",
"google-it": "^1.6.2",
"google-sr": "^1.0.4",
"google-sr": "^2.0.0",
"he": "^1.2.0",
"jaro-winkler": "^0.2.8",
"line-by-line": "^0.1.6",
@@ -1421,13 +1421,20 @@
"integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw=="
},
"node_modules/google-sr": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/google-sr/-/google-sr-1.0.4.tgz",
"integrity": "sha512-4xTaH/fZARZgmf6IXPbTSS4nYDqG5M6SkAL01j4re9tdX28heNEJ9PA5WtnyGXwMo9fBO2wxWNBRWfznsjPHbQ==",
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/google-sr/-/google-sr-2.0.0.tgz",
"integrity": "sha512-jFKybdBFAHTkLPcNfIZBUcF8cvlxpsqLt9J6JPUaMm+j0vrVd9aKIOwH4ROphylMFhwXg7RglKRuNS71bxmgOg==",
"dependencies": {
"cheerio": "1.0.0-rc.10",
"node-fetch": "2.6.2",
"querystring": "0.2.1"
"axios": "^0.26.0",
"cheerio": "^1.0.0-rc.10"
}
},
"node_modules/google-sr/node_modules/axios": {
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.26.0.tgz",
"integrity": "sha512-lKoGLMYtHvFrPVt3r+RBMp9nh34N0M8zEfCWqdWZx6phynIEhQqAdydpyBAAG211zlhX9Rgu08cOamy6XjE5Og==",
"dependencies": {
"follow-redirects": "^1.14.8"
}
},
"node_modules/google-sr/node_modules/cheerio": {
@@ -1488,6 +1495,25 @@
"resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz",
"integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A=="
},
"node_modules/google-sr/node_modules/follow-redirects": {
"version": "1.14.9",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz",
"integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==",
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/RubenVerborgh"
}
],
"engines": {
"node": ">=4.0"
},
"peerDependenciesMeta": {
"debug": {
"optional": true
}
}
},
"node_modules/google-sr/node_modules/htmlparser2": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz",
@@ -1504,14 +1530,6 @@
"resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz",
"integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw=="
},
"node_modules/google-sr/node_modules/querystring": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.1.tgz",
"integrity": "sha512-wkvS7mL/JMugcup3/rMitHmd9ecIGd2lhFhK9N3UUQ450h66d1r3Y9nvXzQAW1Lq+wyx61k/1pfKS5KuKiyEbg==",
"engines": {
"node": ">=0.4.x"
}
},
"node_modules/har-schema": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
@@ -5128,15 +5146,22 @@
}
},
"google-sr": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/google-sr/-/google-sr-1.0.4.tgz",
"integrity": "sha512-4xTaH/fZARZgmf6IXPbTSS4nYDqG5M6SkAL01j4re9tdX28heNEJ9PA5WtnyGXwMo9fBO2wxWNBRWfznsjPHbQ==",
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/google-sr/-/google-sr-2.0.0.tgz",
"integrity": "sha512-jFKybdBFAHTkLPcNfIZBUcF8cvlxpsqLt9J6JPUaMm+j0vrVd9aKIOwH4ROphylMFhwXg7RglKRuNS71bxmgOg==",
"requires": {
"cheerio": "1.0.0-rc.10",
"node-fetch": "2.6.2",
"querystring": "0.2.1"
"axios": "^0.26.0",
"cheerio": "^1.0.0-rc.10"
},
"dependencies": {
"axios": {
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.26.0.tgz",
"integrity": "sha512-lKoGLMYtHvFrPVt3r+RBMp9nh34N0M8zEfCWqdWZx6phynIEhQqAdydpyBAAG211zlhX9Rgu08cOamy6XjE5Og==",
"requires": {
"follow-redirects": "^1.14.8"
}
},
"cheerio": {
"version": "1.0.0-rc.10",
"resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.10.tgz",
@@ -5189,6 +5214,11 @@
"resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz",
"integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A=="
},
"follow-redirects": {
"version": "1.14.9",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz",
"integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w=="
},
"htmlparser2": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz",
@@ -5204,11 +5234,6 @@
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz",
"integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw=="
},
"querystring": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.1.tgz",
"integrity": "sha512-wkvS7mL/JMugcup3/rMitHmd9ecIGd2lhFhK9N3UUQ450h66d1r3Y9nvXzQAW1Lq+wyx61k/1pfKS5KuKiyEbg=="
}
}
},

View File

@@ -17,7 +17,7 @@
"cheerio": "^0.22.0",
"express": "^4.16.4",
"google-it": "^1.6.2",
"google-sr": "^1.0.4",
"google-sr": "^2.0.0",
"he": "^1.2.0",
"jaro-winkler": "^0.2.8",
"line-by-line": "^0.1.6",

View File

@@ -108,10 +108,10 @@ async function getImdbId(info, type) {
reject(err || new Error('failed imdbId search'));
}
});
}).catch(() => googleSr(query)
.then(response => response.searchResults.length ? response.searchResults : Promise.reject('No results'))
}).catch(() => googleSr.search(query)
.then(response => response.length ? response : Promise.reject('No results'))
.then(results => results
.map(result => result.link)
.map(result => result.Link)
.find(result => result.includes('imdb.com/title/')))
.then(result => result && result.match(/imdb\.com\/title\/(tt\d+)/))
.then(match => match && match[1])))