|
@@ -46,8 +46,13 @@ for (let page = 0; page < MAX_PAGES; page++) {
|
|
|
const text = textNode.html()?.trim() || "";
|
|
const text = textNode.html()?.trim() || "";
|
|
|
const datetime = $el.find("time").first().attr("datetime") || "";
|
|
const datetime = $el.find("time").first().attr("datetime") || "";
|
|
|
const photoStyle = $el.find(".tgme_widget_message_photo_wrap").first().attr("style") || "";
|
|
const photoStyle = $el.find(".tgme_widget_message_photo_wrap").first().attr("style") || "";
|
|
|
- const photo = photoStyle.match(/url\('([^']+)'\)/)?.[1]?.split("?")[0] || "";
|
|
|
|
|
|
|
+ let photo = photoStyle.match(/url\('([^']+)'\)/)?.[1]?.split("?")[0] || "";
|
|
|
const video = $el.find(".tgme_widget_message_video_wrap, .tgme_widget_message_video_player").length > 0;
|
|
const video = $el.find(".tgme_widget_message_video_wrap, .tgme_widget_message_video_player").length > 0;
|
|
|
|
|
+ // video posts carry a full-size preview frame in .tgme_widget_message_video_thumb
|
|
|
|
|
+ if (video && !photo) {
|
|
|
|
|
+ const thumbStyle = $el.find(".tgme_widget_message_video_thumb").first().attr("style") || "";
|
|
|
|
|
+ photo = thumbStyle.match(/url\('([^']+)'\)/)?.[1] || "";
|
|
|
|
|
+ }
|
|
|
const link = $el.find(".tgme_widget_message_date").first().attr("href") || `https://t.me/${CHANNEL}/${postId}`;
|
|
const link = $el.find(".tgme_widget_message_date").first().attr("href") || `https://t.me/${CHANNEL}/${postId}`;
|
|
|
if (text || photo || video) {
|
|
if (text || photo || video) {
|
|
|
posts.push({ id: Number(postId), text, datetime, photo, video, link });
|
|
posts.push({ id: Number(postId), text, datetime, photo, video, link });
|