Skip to content

Commit

Permalink
add tiktok stalk
Browse files Browse the repository at this point in the history
  • Loading branch information
thoriqazzikraa committed May 31, 2024
1 parent 3052ffe commit fab0bd5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
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.78",
"version": "1.0.79",
"description": "Website Scraping",
"main": "index.js",
"scripts": {
Expand Down
27 changes: 27 additions & 0 deletions src/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,32 @@ const cheerio = require("cheerio")
const baseIg = "https://igram.world/"
const { convertMs } = require("../function/number.js")

async function tiktokStalk(user) {
try {
const { data } = await axios.get(`https://tiktok.com/@${user}`, {
headers: {
"User-Agent": "PostmanRuntime/7.32.2"
}
})
const $ = cheerio.load(data)
const dats = $("#__UNIVERSAL_DATA_FOR_REHYDRATION__").text()
const result = JSON.parse(dats)
if (result["__DEFAULT_SCOPE__"]["webapp.user-detail"].statusCode !== 0) {
const ress = {
status: "error",
message: "User not found!"
}
console.log(ress)
return ress
}
const res = result["__DEFAULT_SCOPE__"]["webapp.user-detail"]["userInfo"]
return res
} catch (err) {
console.log(err)
return String(err)
}
}

async function tvList() {
try {
const { data } = await axios.get("https://www.jadwaltv.net/")
Expand Down Expand Up @@ -409,6 +435,7 @@ async function similarBand(query) {
}

module.exports = {
tiktokStalk,
tvList,
jadwalTv,
similarSongs,
Expand Down

0 comments on commit fab0bd5

Please sign in to comment.