Skip to content

Commit

Permalink
fixed twitter downloader quality text
Browse files Browse the repository at this point in the history
  • Loading branch information
thoriqazzikraa committed Feb 17, 2024
1 parent 24a581b commit 39ce406
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
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.62",
"version": "1.0.63",
"description": "Website Scraping",
"main": "index.js",
"scripts": {
Expand Down
9 changes: 7 additions & 2 deletions src/downloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@ async function twitterdl2(url) {
})
} else {
$("div.tw-video").each(function () {
if ($(this).find(".tw-right > div > p:nth-child(1) > a").text().includes("(")) {
var qualityText = $(this).find(".tw-right > div > p:nth-child(1) > a").text().split("(")[1].split("p")[0].trim()
} else {
var qualityText = $(this).find(".tw-right > div > p:nth-child(1) > a").text().trim()
}
result.type = "video"
result.media.push({
quality: $(this).find(".tw-right > div > p:nth-child(1) > a").text().split("(")[1].split(")")[0],
quality: qualityText,
url: $(this).find(".tw-right > div > p:nth-child(1) > a").attr("href")
})
})
Expand All @@ -36,7 +41,7 @@ async function twitterdl2(url) {
} catch (err) {
const result = {
status: false,
message: "Media not found!" + String(err)
message: "Media not found!\n\n" + String(err)
}
console.log(result)
return result
Expand Down

0 comments on commit 39ce406

Please sign in to comment.