diff --git a/config/config.js b/config/config.js new file mode 100644 index 0000000..19b136f --- /dev/null +++ b/config/config.js @@ -0,0 +1,5 @@ +module.exports = config = { + baseFilmApik: "https://filmapik.ing/", + baseIgram: "https://igram.world/", + baseOtakudesu: "https://otakudesu.cloud/" +} diff --git a/example/ai.js b/example/ai.js new file mode 100644 index 0000000..86d761f --- /dev/null +++ b/example/ai.js @@ -0,0 +1,9 @@ +const { ai } = require("../index.js") + +// text to picture +async function textToPicture(text) { + const data = await ai.textToImage(text) + console.log(data) + return data +} +textToPicture("a girl standing on the field") diff --git a/example/downloader.js b/example/downloader.js new file mode 100644 index 0000000..ca675fe --- /dev/null +++ b/example/downloader.js @@ -0,0 +1,65 @@ +const { downloader } = require("../index.js") + +// Twitter downloader +async function twitterDownloader(url) { + const data = await downloader.twitterdl(url) // if error, change to twitterdl2 + console.log(data) + return data +} +twitterDownloader("https://twitter.com/sapphoria_th/status/1803300713461850183?t=mlTZ031i-2vzHUrnW2sG0g&s=19") + +// Instagram downloader +async function instagramDownloader(url) { + const data = await downloader.igdl(url) // if error, change to igdl2 + console.log(data) + return data +} +instagramDownloader("https://www.instagram.com/reel/C8M8BJ-Ad91/") + +// Instagram story downloader +async function instagramStory(username) { + const data = await downloader.igStory(username) // if error, change to igStory2 + console.log(data) + return data +} +instagramStory("nechlophomeria") + +// Facebook downloader +async function facebookDownloader(url) { + const data = await downloader.fbdl(url) + console.log(data) + return data +} +facebookDownloader("https://www.facebook.com/share/r/TNJa6gmMyvkq8FpE/?mibextid=0VwfS7") + +// Pinterest downloader +async function pinterestDownloader(url) { + const data = await downloader.pindl(url) + console.log(data) + return data +} +pinterestDownloader("https://pin.it/6AJjwwMPr") + +// Tiktok downloader +async function tiktokDownloader(url) { + const data = await downloader.tiktokdl(url) // if error, change to tiktokdl2 + console.log(data) + return data +} +tiktokDownloader("https://vt.tiktok.com/ZSYfbE2Ar/") + +// Spotify downloader +async function spotifyDownloader(url) { + const data = await downloader.spotify(url) // i recommended using my other module "@nechlophomeriaa/spotifydl" on NPM + console.log(data) + return data +} +spotifyDownloader("https://open.spotify.com/track/5BqwC9kOBbqYkzdOKeXFFk?si=MIxzvztbQqqOeaPWHvNNzw&context=spotify%3Aalbum%3A28GiIRNu9nEugqnUci3aIC") + +// Threads downloader +async function threadsDownloader(url) { + const data = await downloader.threads(url) + console.log(data) + return data +} +threadsDownloader("https://www.threads.net/@433/post/C8Vj9RjCjzU/?xmt=AQGzeNiQUTut7l437uo6JNnBXItuB-QoeVbUytJcdMVotA") diff --git a/example/image/test.jpg b/example/image/test.jpg new file mode 100644 index 0000000..a4acea3 Binary files /dev/null and b/example/image/test.jpg differ diff --git a/example/random.js b/example/random.js new file mode 100644 index 0000000..e05bc41 --- /dev/null +++ b/example/random.js @@ -0,0 +1,49 @@ +const { random } = require("../index.js") + +// random pics anime +async function animePics(query) { + if (query === "neko") { + var data = await random.anime.neko() + } else if (query === "waifu") { + var data = await random.anime.waifu() + } else if (query === "shinobu") { + var data = await random.anime.shinobu() + } else { + return "Random anime picture you choose not found" + } + console.log(data) + return data +} +animePics("neko") + +// random gore videos +async function randomGore() { + const data = await random.randomGore() + console.log(data) + return data +} +randomGore() + +// get random hubble images from https://esahubble.org/images +async function hubbleImages() { + const data = await random.hubbleImg() + console.log(data) + return data +} +hubbleImages() + +// get random truth or dare +async function truthOrDare() { + const data = await random.truthOrDare() + console.log(data) + return data +} +truthOrDare() + +// get random tiktok videos from username +async function randomTiktok(username) { + const data = await random.randomTiktok(username) + console.log(data) + return data +} +randomTiktok("nechlophomeria") diff --git a/example/search.js b/example/search.js new file mode 100644 index 0000000..cbe2228 --- /dev/null +++ b/example/search.js @@ -0,0 +1,81 @@ +const { search } = require("../index.js") + +// Search / stalking tiktok user profile +async function tiktokProfile(username) { + const data = await search.tiktokStalk(username) + console.log(data) + return data +} +tiktokProfile("nechlophomeria") + +// Jadwal tv +async function jadwalTv(tv) { + const data = await search.jadwalTv(tv) + console.log(data) + return data +} +jadwalTv("mnctv") + +// Search similar songs +async function similarSongs(songs) { + const data = await search.similarSongs(songs) + console.log(data) + return data +} +similarSongs("summer salt fire flower") + +// Find songs by lyrics +async function findSongsByLyrics(lyrics) { + const data = await search.findSongs(lyrics) + console.log(data) + return data +} +findSongsByLyrics("always reminded of the days when you were my cherry lime") + +// search lyrics from title of the songs +async function searchLyrics(query) { + const data = await search.lyrics(query) // if error, change to lyrics2 + console.log(data) + return data +} +searchLyrics("summer salt fire flower") + +// search similar bands +async function similarBands(bands) { + const data = await search.similarBand(bands) + console.log(data) + return data +} +similarBands("jannabi") + +// search / stalk instagram profile +async function instagramProfile(username) { + const data = await search.igStalk2(username) // if error, change to igStalk2 + console.log(data) + return data +} +instagramProfile("nechlophomeria") + +// search movie from website Film Apik +async function searchFilm(query) { + const data = await search.filmApikS(query) + console.log(data) + return data +} +searchFilm("the conjuring") + +// get download link movie from url +async function filmapikDownloader(url) { + const data = await search.filmApikDl(url) + console.log(data) + return data +} +filmapikDownloader("https://filmapik.ing/nonton-film-the-conjuring-the-devil-made-me-do-it-2021-subtitle-indonesia/play") + +// search anime from otakudesu +async function otakudesu(query) { + const data = await search.otakuDesuSearch(query) + console.log(data) + return data +} +otakudesu("kimetsu no yaiba") diff --git a/example/tools.js b/example/tools.js new file mode 100644 index 0000000..45fa0f4 --- /dev/null +++ b/example/tools.js @@ -0,0 +1,23 @@ +const { tools } = require("../index.js") +const fetch = require("node-fetch") +const fs = require("fs") + +// upload files +// example with path +async function uploadFilesViaPath(path) { + const filePath = path // "./folder/to/files" + const buffer = fs.readFileSync(filePath) + const uploadFile = await tools.uploadFile(buffer) + console.log(uploadFile) + return uploadFile +} +uploadFilesViaPath(__dirname + "/image/test.jpg") + +// example with url +async function uploadFilesViaUrl(url) { + const buffer = await fetch(url).then((res) => res.buffer()) + const data = await tools.uploadFile(buffer) + console.log(data) + return data +} +uploadFilesViaUrl("https://avatars.githubusercontent.com/thoriqazzikraa") diff --git a/package.json b/package.json index abb74d7..eefab27 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scrape-websitee", - "version": "1.0.79", + "version": "1.0.80", "description": "Website Scraping", "main": "index.js", "scripts": { diff --git a/src/downloader.js b/src/downloader.js index 8868ad3..b2b60f0 100644 --- a/src/downloader.js +++ b/src/downloader.js @@ -229,23 +229,23 @@ async function pindl(url) { try { const { data } = await axios.get(`https://www.savepin.app/download.php?url=${url}&lang=en&type=redirect`) const $ = cheerio.load(data) - if ($(".download-link > div:nth-child(2) > div > table > tbody > tr:nth-child(1) > td:nth-child(3) > a").attr("href").includes("force-save.php")) { - var urll = decodeURIComponent($(".download-link > div:nth-child(2) > div > table > tbody > tr:nth-child(1) > td:nth-child(3) > a").attr("href").split("url=")[1]) + const sources = $(".download-link > div:nth-child(5) > div:nth-child(1) > table > tbody > tr:nth-child(1) > td:nth-child(3) > a").attr("href") + if (sources.includes("force-save.php")) { + var urll = decodeURIComponent(sources.split("url=")[1]) } else { - var urll = $(".download-link > div:nth-child(2) > div > table > tbody > tr:nth-child(1) > td:nth-child(3) > a").attr("href") + var urll = $(".download-link > div:nth-child(5) > div:nth-child(1) > table > tbody > tr:nth-child(1) > td:nth-child(3) > a").attr("href") } const result = { status: true, url: urll } - console.log(result) return result } catch (err) { result = { status: false, msg: "Error: Invalid URL!" } - console.log(result) + console.log(err) return result } } diff --git a/src/random.js b/src/random.js index 83f7e0c..03cc3f1 100644 --- a/src/random.js +++ b/src/random.js @@ -114,7 +114,7 @@ async function randomTiktok(username) { const { data } = await axios.get(`https://tiktok-video-no-watermark2.p.rapidapi.com/user/posts?unique_id=${user}&count=1000`, { headers: { Accept: "application/json", - "X-RapidAPI-Key": "533115be6amsh2515f73f171c6f1p160d9djsn833294e42f10", + "X-RapidAPI-Key": "61f99d3e77msh61688cbb09796b4p18b365jsn09c26ce3e5c4", "X-RapidAPI-Host": "tiktok-video-no-watermark2.p.rapidapi.com", "User-Agent": "PostmanRuntime/7.32.2", Referer: "https://tik.storyclone.com/" diff --git a/src/search.js b/src/search.js index 222e277..8fc24b1 100644 --- a/src/search.js +++ b/src/search.js @@ -1,8 +1,6 @@ const axios = require("axios") -const baseOtakudesu = "https://otakudesu.lol/" -const baseFilmApik = "https://filmapik21.live/" +const { baseFilmApik, baseOtakudesu, baseIgram } = require("../config/config.js") const cheerio = require("cheerio") -const baseIg = "https://igram.world/" const { convertMs } = require("../function/number.js") async function tiktokStalk(user) { @@ -107,7 +105,7 @@ async function filmApikS(query) { rating: $(this).find(".details > .meta > span").text().replace("IMDb ", "").replace("TMDb ", ""), thumbnail: $(this).find(".image > div > a > img").attr("src"), url: $(this).find(".image > div > a").attr("href"), - synopsis: $(this).find(".details > .contenido > p").text() + synopsis: $(this).find(".details > .contenido > p").text().split("ALUR CERITA : – ")[1] }) }) if (result.data.length === 0) { @@ -334,7 +332,7 @@ async function lyrics(query) { async function igStalk(username) { try { - const { data, status } = await axios.get(`${baseIg}api/ig/userInfoByUsername/${username}`, { + const { data, status } = await axios.get(`${baseIgram}api/ig/userInfoByUsername/${username}`, { headers: { "User-Agent": "PostmanRuntime/7.37.0" } diff --git a/src/temp/text.txt b/src/temp/text.txt new file mode 100644 index 0000000..e69de29 diff --git a/src/tools.js b/src/tools.js index 3e29ced..c590245 100644 --- a/src/tools.js +++ b/src/tools.js @@ -6,7 +6,7 @@ const { fromBuffer } = require("file-type") async function uploadFile(buffer) { const { ext, mime } = await fromBuffer(buffer) - const filePath = `temp/${Date.now()}.${ext}` + const filePath = __dirname + `/temp/${Date.now()}.${ext}` await fs.writeFileSync(filePath, buffer) const fileData = fs.readFileSync(filePath) try {