Skip to content

Commit

Permalink
feat: add actionLink
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmeterenodaci committed Jul 5, 2024
1 parent 353ea5d commit 80f5cf4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ export async function TelegramMessageScraper(channelName) {
const regex = /<span class="tgme_widget_message_views">(.*?)<\/span>/g;
return regex.exec(html)?.[1];
}
function getActionLink(html) {
const regex =
/<a class="tgme_widget_message_inline_button url_button" href="(.*?)"/g;
return regex.exec(html)?.[1];
}
async function getChannelMessages(channelName) {
const url = `https://t.me/s/${channelName}`;
const result = await fetch(url);
Expand All @@ -57,6 +62,7 @@ export async function TelegramMessageScraper(channelName) {
message: getMessage(message),
image: getImage(message),
views: getViews(message),
actionLink: getActionLink(message),
});
});
return messages;
Expand Down

0 comments on commit 80f5cf4

Please sign in to comment.