mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 15:28:26 +01:00
18 lines
474 B
JavaScript
18 lines
474 B
JavaScript
|
const fetch = require("node-fetch");
|
||
|
const xmltojson = require("xml2json")
|
||
|
const url = require("../config.json")
|
||
|
|
||
|
class Search{
|
||
|
static async SearchVideo(query){
|
||
|
const search = await fetch(`https://lighttube.herokuapp.com/api/search?query=${query}`)
|
||
|
const text = await search.text()
|
||
|
const j = JSON.parse(xmltojson.toJson(text));
|
||
|
for (item of j.Search.Results.Video) {
|
||
|
const videoid = item;
|
||
|
return item;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = Search
|