poke/sdk/src/search.js

18 lines
466 B
JavaScript
Raw Normal View History

2022-03-25 18:46:07 +01:00
const fetch = require("node-fetch");
const xmltojson = require("xml2json")
const url = require("../config.json")
class Search{
static async SearchVideo(query){
2022-06-22 13:44:12 +02:00
const search = await fetch(`https://tube.kuylar.dev/api/search?query=${query}`)
2022-03-25 18:46:07 +01:00
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