2023-03-29 23:54:25 +08:00
|
|
|
export default function getVideoAttributes(cooked) {
|
|
|
|
if (!cooked.classList.contains("lazy-video-container")) {
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
|
|
|
const url = cooked.querySelector("a")?.getAttribute("href");
|
2023-04-13 19:04:46 +08:00
|
|
|
const img = cooked.querySelector("img");
|
|
|
|
const thumbnail = img?.getAttribute("src");
|
|
|
|
const dominantColor = img?.dataset?.dominantColor;
|
2023-03-29 23:54:25 +08:00
|
|
|
const title = cooked.dataset.videoTitle;
|
2023-07-03 21:39:37 +08:00
|
|
|
const startTime = cooked.dataset.videoStartTime;
|
2023-03-29 23:54:25 +08:00
|
|
|
const providerName = cooked.dataset.providerName;
|
|
|
|
const id = cooked.dataset.videoId;
|
|
|
|
|
2023-04-28 21:46:27 +08:00
|
|
|
return { url, thumbnail, title, providerName, id, dominantColor, startTime };
|
2023-03-29 23:54:25 +08:00
|
|
|
}
|