fix: error when download images from musicaldown
This commit is contained in:
parent
fcc542f462
commit
d92bb6942a
@ -1,7 +1,17 @@
|
|||||||
export type TiktokUserSearchResponse = {
|
export type TiktokUserSearchResponse = {
|
||||||
status: "success" | "error"
|
status: "success" | "error"
|
||||||
message?: string
|
message?: string
|
||||||
result?: Result[]
|
result?: Array<{
|
||||||
|
uid: string
|
||||||
|
username: string
|
||||||
|
nickname: string
|
||||||
|
signature: string
|
||||||
|
followerCount: number
|
||||||
|
avatarThumb: string
|
||||||
|
isVerified: boolean
|
||||||
|
secUid: string
|
||||||
|
url: string
|
||||||
|
}>
|
||||||
page?: number
|
page?: number
|
||||||
totalResults?: number
|
totalResults?: number
|
||||||
}
|
}
|
||||||
@ -17,3 +27,8 @@ export type Result = {
|
|||||||
secUid: string
|
secUid: string
|
||||||
url: string
|
url: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IUserSearch {
|
||||||
|
saveSearch(searchTerm: string): void
|
||||||
|
getLastSearch(): string | null
|
||||||
|
}
|
||||||
|
|||||||
@ -138,32 +138,6 @@ export const MusicalDown = (
|
|||||||
images.push($(v).find("img").attr("src"))
|
images.push($(v).find("img").attr("src"))
|
||||||
})
|
})
|
||||||
|
|
||||||
// Get Result Video
|
|
||||||
let i = 1
|
|
||||||
let videos = {}
|
|
||||||
$("div.row > div")
|
|
||||||
.map((_, el) => $(el))
|
|
||||||
.get(1)
|
|
||||||
.find("a")
|
|
||||||
.get()
|
|
||||||
.map((v: any) => {
|
|
||||||
if ($(v).attr("href") !== "#modal2") {
|
|
||||||
if (!isURL($(v).attr("href"))) return
|
|
||||||
videos[
|
|
||||||
$(v).attr("data-event").includes("hd")
|
|
||||||
? "videoHD"
|
|
||||||
: $(v).attr("data-event").includes("mp4")
|
|
||||||
? "videoSD"
|
|
||||||
: $(v).attr("data-event").includes("watermark")
|
|
||||||
? "videoWatermark"
|
|
||||||
: $(v).attr("href").includes("type=mp3") && "music"
|
|
||||||
] =
|
|
||||||
$(v).attr("href") != undefined
|
|
||||||
? $(v).attr("href")
|
|
||||||
: /downloadX\('([^']+)'\)/.exec($(v).attr("onclick"))[1]
|
|
||||||
i++
|
|
||||||
}
|
|
||||||
})
|
|
||||||
// Result
|
// Result
|
||||||
if (images.length !== 0) {
|
if (images.length !== 0) {
|
||||||
// Images or Slide Result
|
// Images or Slide Result
|
||||||
@ -176,7 +150,33 @@ export const MusicalDown = (
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// Video Result
|
// Video Result
|
||||||
// const music = await getMusic(request.cookie)
|
// Get Result Video
|
||||||
|
let i = 1
|
||||||
|
let videos = {}
|
||||||
|
$("div.row > div")
|
||||||
|
.map((_, el) => $(el))
|
||||||
|
.get(1)
|
||||||
|
.find("a")
|
||||||
|
.get()
|
||||||
|
.map((v: any) => {
|
||||||
|
if ($(v).attr("href") !== "#modal2") {
|
||||||
|
if (!isURL($(v).attr("href"))) return
|
||||||
|
videos[
|
||||||
|
$(v).attr("data-event").includes("hd")
|
||||||
|
? "videoHD"
|
||||||
|
: $(v).attr("data-event").includes("mp4")
|
||||||
|
? "videoSD"
|
||||||
|
: $(v).attr("data-event").includes("watermark")
|
||||||
|
? "videoWatermark"
|
||||||
|
: $(v).attr("href").includes("type=mp3") && "music"
|
||||||
|
] =
|
||||||
|
$(v).attr("href") != undefined
|
||||||
|
? $(v).attr("href")
|
||||||
|
: /downloadX\('([^']+)'\)/.exec($(v).attr("onclick"))[1]
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
if (Object.keys(videos).length === 0)
|
if (Object.keys(videos).length === 0)
|
||||||
return resolve({
|
return resolve({
|
||||||
status: "success",
|
status: "success",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user