poke/sdk/src/search.js
2022-06-22 14:44:12 +03:00

17 lines
466 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://tube.kuylar.dev/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