Skip to content

Commit

Permalink
fixed tiktok downloader
Browse files Browse the repository at this point in the history
  • Loading branch information
thoriqazzikraa committed Sep 23, 2023
1 parent 333efee commit 18fea00
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Install
```
npm i scrape-websitee
```sh
> npm i scrape-websitee
```

# Usage
Expand Down
24 changes: 11 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -589,22 +589,20 @@ async function cekResi(kurir, resi) {

async function tiktokdl(url) {
try {
const getUdid = async () => {
const { data } = await axios.get(`https://tikdown.org`)
let $ = cheerio.load(data)
return $("meta:nth-child(2)").attr("content")
}
const { data } = await axios.get(`https://tikdown.org/getAjax?url=${url}&_token=${getUdid}`)
let $ = cheerio.load(data.html)
let result = { status: true, media: [] }
$("div.download-result > .download-links > div.button-primary-gradient").each(function () {
result.media.push($(this).find("a").attr("href"))
const { data } = await axios(`https://downloader.bot/api/tiktok/info`, {
method: "post",
data: { url: url },
headers: {
Accept: "application/json",
"Content-Type": "application/json"
}
})
return result
} catch {
return data
} catch (err) {
const result = {
status: false,
message: "Couldn't fetch data of url"
message: "Video not found",
messageCmd: String(err)
}
console.log(result)
return result
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scrape-websitee",
"version": "1.0.45",
"version": "1.0.46",
"description": "Website Scraping",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -29,7 +29,7 @@
"file-type-cjs-fix": "^1.1.1",
"form-data": "^4.0.0",
"fs": "^0.0.1-security",
"node-fetch": "^2.6.6",
"node-fetch": "2.6.6",
"prettier": "^3.0.3"
}
}

0 comments on commit 18fea00

Please sign in to comment.