I use NodeJS for a Telegram bot; with NodeJS you can use a webhook or some polling to retreive information that is placed in a website and take it back to Telegram in any format you like.
I use this particular code to extract an ever-changing dollar value (but the trigger is not the change but a command that pulls it; this, I hope, you can change if you want).
bot.onText(/\/dolar/, function (msg) {
request('https://twitter.com/DolarToday', function (error, response, html) {
if (!error && response.statusCode == 200) {
var loadedHTML = cheerio.load(html);
var contentContainer = loadedHTML('p.ProfileHeaderCard-bio').text();
var soughtContent = contentContainer.substring(contentContainer.search("Bs."), contentContainer.search(" y el"));
return bot.sendMessage(msg.chat.id, soughtContent); //outputs a value like `Bs. 1904,48`
} else {
console.log(error);
}
});
console.log('Sent dollar value');
});
To do this you need three modules: node-telegram-bot-api
for the bot interaction with Telegram, request
for the http access and cheerio
for the jQuery select and pull.