File size: 939 Bytes
2dddd1f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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;
            }
        }
    });
});