Skip to content

Commit

Permalink
fixed some features and add example folder
Browse files Browse the repository at this point in the history
  • Loading branch information
thoriqazzikraa committed Jun 20, 2024
1 parent fab0bd5 commit c9269b3
Show file tree
Hide file tree
Showing 13 changed files with 243 additions and 13 deletions.
5 changes: 5 additions & 0 deletions config/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = config = {
baseFilmApik: "https://filmapik.ing/",
baseIgram: "https://igram.world/",
baseOtakudesu: "https://otakudesu.cloud/"
}
9 changes: 9 additions & 0 deletions example/ai.js
Original file line number Diff line number Diff line change
@@ -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")
65 changes: 65 additions & 0 deletions example/downloader.js
Original file line number Diff line number Diff line change
@@ -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")
Binary file added example/image/test.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions example/random.js
Original file line number Diff line number Diff line change
@@ -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")
81 changes: 81 additions & 0 deletions example/search.js
Original file line number Diff line number Diff line change
@@ -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")
23 changes: 23 additions & 0 deletions example/tools.js
Original file line number Diff line number Diff line change
@@ -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")
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.79",
"version": "1.0.80",
"description": "Website Scraping",
"main": "index.js",
"scripts": {
Expand Down
10 changes: 5 additions & 5 deletions src/downloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/random.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down
8 changes: 3 additions & 5 deletions src/search.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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"
}
Expand Down
Empty file added src/temp/text.txt
Empty file.
2 changes: 1 addition & 1 deletion src/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c9269b3

Please sign in to comment.