-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add rules to expand search queries (#121)
* update acknowledgements * add rules to expand search query * update version
- Loading branch information
1 parent
ef68981
commit 405415f
Showing
14 changed files
with
122 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,4 +104,5 @@ dist | |
.tern-port | ||
|
||
/build/ | ||
frontend/ | ||
frontend/ | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const Axios = require('axios').default; | ||
const utils = require('./utils'); | ||
const ds = require('../ds'); | ||
|
||
const requester = utils.requester('https://api.avgle.com'); | ||
|
||
const searchByCode = async (code) => { | ||
const rsp = await requester.get(`/v1/search/${code}/0?limit=1`); | ||
const video = rsp.data.response.videos[0]; | ||
|
||
const testVideo = await Axios.get(encodeURI(video.video_url), { maxRedirects: 0 }); | ||
if (testVideo.status === 301) { | ||
return null; | ||
} | ||
|
||
if (video.title.toLowerCase().includes(code.toLowerCase())) { | ||
const av = new ds.AV(); | ||
av.title = video.title; | ||
av.video_url = video.video_url; | ||
av.code = code; | ||
av.preview_img_url = video.preview_url; | ||
return av; | ||
} | ||
return null; | ||
}; | ||
|
||
module.exports = { | ||
searchByCode, | ||
}; |