Spaces:
Sleeping
Sleeping
| const https = require('https'); | |
| https.get('https://t.me/s/iraqborsa', (res) => { | |
| let data = ''; | |
| res.on('data', chunk => data += chunk); | |
| res.on('end', () => { | |
| const regex = /<div class="tgme_widget_message_text[^>]*>(.*?)<\/div>/g; | |
| let match; | |
| const messages = []; | |
| while ((match = regex.exec(data)) !== null) { | |
| // Strip HTML tags (like <br/>) | |
| messages.push(match[1].replace(/<[^>]+>/g, ' ')); | |
| } | |
| // Output the last 5 messages | |
| console.log(messages.slice(-5)); | |
| // Find matching rates | |
| const rateRegex = /100\$\s*=\s*(\d{2,3})[,.]?(\d{3})/; | |
| for (const msg of messages.reverse()) { | |
| const found = msg.match(rateRegex); | |
| if (found) { | |
| const val = found[1] + found[2]; | |
| console.log('Found rate:', val); | |
| break; | |
| } | |
| } | |
| }); | |
| }); | |