Skip to content

Commit

Permalink
add jadwal tv
Browse files Browse the repository at this point in the history
  • Loading branch information
thoriqazzikraa committed Mar 19, 2024
1 parent 303c127 commit 09d495d
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const scrape = require("scrape-websitee")
igdl, // (url)
},
search: {
tvList,
jadwalTv, // (query)
similarSongs, // (query)
findSongs, // (query)
lyrics, // (query)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scrape-websitee",
"version": "1.0.68",
"version": "1.0.69",
"description": "Website Scraping",
"main": "index.js",
"scripts": {
Expand Down
1 change: 0 additions & 1 deletion src/downloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
45 changes: 43 additions & 2 deletions src/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
}
Expand Down Expand Up @@ -370,6 +409,8 @@ async function similarBand(query) {
}

module.exports = {
tvList,
jadwalTv,
similarSongs,
findSongs,
lyrics,
Expand Down

0 comments on commit 09d495d

Please sign in to comment.