diff --git a/README.md b/README.md index e386eb0..2387cce 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,8 @@ const scrape = require("scrape-websitee") igdl, // (url) }, search: { + tvList, + jadwalTv, // (query) similarSongs, // (query) findSongs, // (query) lyrics, // (query) diff --git a/package.json b/package.json index b490e16..abca244 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scrape-websitee", - "version": "1.0.68", + "version": "1.0.69", "description": "Website Scraping", "main": "index.js", "scripts": { diff --git a/src/downloader.js b/src/downloader.js index 976accc..c5de81b 100644 --- a/src/downloader.js +++ b/src/downloader.js @@ -403,7 +403,6 @@ async function igStory2(username) { result.media = null result.message = `The account you're looking for doesn't have any stories or maybe the account is private.` } - console.log(result) return result } catch (err) { console.log(err) diff --git a/src/search.js b/src/search.js index 7726e01..12b9406 100644 --- a/src/search.js +++ b/src/search.js @@ -2,9 +2,48 @@ const axios = require("axios") const baseOtakudesu = "https://otakudesu.lol/" const baseFilmApik = "https://filmapik21.live/" const cheerio = require("cheerio") -const baseSSS = "https://instasupersave.com/" +const baseIg = "https://igram.world/" const { convertMs } = require("../function/number.js") +async function tvList() { + try { + const { data } = await axios.get("https://www.jadwaltv.net/") + let $ = cheerio.load(data) + result = [] + $("nav#jadwaltv > ul > li").each(function () { + let tv = $(this).find("a > span").text().replace(" ", "") + result.push(tv) + }) + return result.join(", ").split("SedangTayang")[0] + } catch (err) { + console.log(err) + return String(err) + } +} + +async function jadwalTv(tv) { + let result = { status: null, message: "", result: [] } + try { + const channel = tv.replace(" ", "").toLowerCase() + const { data } = await axios.get("https://jadwaltv.net/channel/" + channel) + let $ = cheerio.load(data) + $("table.table > tbody > tr.jklIv").each(function () { + result.status = true + result.message = "ok" + result.result.push({ + jam: $(this).find("td:nth-child(1)").text().replace("WIB", " WIB"), + program: $(this).find("td:nth-child(2)").text() + }) + }) + return result + } catch (err) { + result.status = false + result.message = "List program for that tv not found" + console.log(result) + return result + } +} + async function otakuDesuSearch(query) { const { data } = await axios.get(`${baseOtakudesu}?s=${query}&post_type=anime`) let i = 0 @@ -269,7 +308,7 @@ async function lyrics(query) { async function igStalk(username) { try { - const { data, status } = await axios.get(`https://igram.world/api/ig/userInfoByUsername/${username}`, { + const { data, status } = await axios.get(`${baseIg}api/ig/userInfoByUsername/${username}`, { headers: { "User-Agent": "PostmanRuntime/7.37.0" } @@ -370,6 +409,8 @@ async function similarBand(query) { } module.exports = { + tvList, + jadwalTv, similarSongs, findSongs, lyrics,