fix(MoreStickers): Animation Stickers (#68)

This commit is contained in:
leko 2024-10-21 02:11:33 +08:00 committed by GitHub
parent 157a0dfe3b
commit 2632f43097
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -66,9 +66,10 @@ function toStickerId(stickerId: string, lineStickerPackId: string): string {
export function convertSticker(s: LineSticker): Sticker { export function convertSticker(s: LineSticker): Sticker {
return { return {
id: toStickerId(s.id, s.stickerPackId), id: toStickerId(s.id, s.stickerPackId),
image: s.staticUrl, image: s.animationUrl || s.staticUrl,
title: s.id, title: s.id,
stickerPackId: toStickerPackId(s.stickerPackId) stickerPackId: toStickerPackId(s.stickerPackId),
isAnimated: !!s.animationUrl
}; };
} }
@ -106,10 +107,10 @@ export function parseHtml(html: string): LineStickerPack {
.map(x => ({ ...x, stickerPackId: id })) as LineSticker[]; .map(x => ({ ...x, stickerPackId: id })) as LineSticker[];
const stickerPack = { const stickerPack = {
title: doc.querySelector("[data-test=sticker-name-title]")?.textContent ?? "null", title: doc.querySelector("[data-test=\"sticker-name-title\"]")?.textContent ?? "null",
author: { author: {
name: doc.querySelector("[data-test=sticker-author]")?.textContent ?? "null", name: doc.querySelector("[data-test=\"sticker-author\"]")?.textContent ?? "null",
url: "https://store.line.me/" + (doc.querySelector("[data-test=sticker-author]")?.getAttribute("href") ?? "null") url: "https://store.line.me/" + (doc.querySelector("[data-test=\"sticker-author\"]")?.getAttribute("href") ?? "null")
}, },
id, id,
mainImage, mainImage,