Skip to content

Commit

Permalink
add type for easy detect
Browse files Browse the repository at this point in the history
  • Loading branch information
thoriqazzikraa committed Feb 24, 2024
1 parent c6c86f8 commit 7792323
Show file tree
Hide file tree
Showing 2 changed files with 5 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.65",
"version": "1.0.66",
"description": "Website Scraping",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 4 additions & 0 deletions src/downloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ async function tiktokdl(url) {
let $ = cheerio.load(data.data)
if ($("div.video-data > .photo-list").length === 0) {
result.status = true
result.type = "video"
result.caption = $("div.video-data > div > .tik-left > .thumbnail > .content > .clearfix > h3").text()
result.thumbnail = $("div.video-data > div > div:nth-child(1) > div > div:nth-child(1) > img").attr("src")
result.video = {}
Expand All @@ -151,6 +152,7 @@ async function tiktokdl(url) {
result.audio.url = $("div.video-data > div > .tik-right > div > p:nth-child(4) > a").attr("href")
} else {
result.status = true
result.type = "image"
result.caption = $("div.video-data > div > .tik-left > .thumbnail > .content > .clearfix > h3").text()
result.thumbnail = $("div.video-data > div > div:nth-child(1) > div > div:nth-child(1) > img").attr("src")
result.audio = {}
Expand Down Expand Up @@ -262,6 +264,7 @@ async function tiktokdl2(url) {
let $ = cheerio.load(data.data)
if ($("div.video-data > .photo-list").length === 0) {
result.status = true
result.type = "video"
result.caption = $("div.video-data > div > .tik-left > .thumbnail > .content > .clearfix > h3").text()
result.thumbnail = $("div.video-data > div > div:nth-child(1) > div > div:nth-child(1) > img").attr("src")
result.video = {}
Expand All @@ -272,6 +275,7 @@ async function tiktokdl2(url) {
result.audio.url = $("div.video-data > div > .tik-right > div > p:nth-child(4) > a").attr("href")
} else {
result.status = true
result.type = "image"
result.caption = $("div.video-data > div > .tik-left > .thumbnail > .content > .clearfix > h3").text()
result.thumbnail = $("div.video-data > div > div:nth-child(1) > div > div:nth-child(1) > img").attr("src")
result.audio = {}
Expand Down

0 comments on commit 7792323

Please sign in to comment.