File size: 2,092 Bytes
ea5d04f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { fetchRSSFeeds } from '../src/rss.js';

async function testRSSFeeds() {
    try {
        // Test with a recent movie - Deadpool & Wolverine
        const imdbId = "tt6263850";
        console.log('\n🧪 Testing RSS Feeds with IMDB ID:', imdbId);

        console.log('Fetching RSS feeds...');
        const streams = await fetchRSSFeeds(imdbId);

        console.log('\n📊 Results:');
        console.log(`Total streams found: ${streams.length}`);

        // Group streams by source
        const sourceGroups = streams.reduce((acc, stream) => {
            acc[stream.source] = acc[stream.source] || [];
            acc[stream.source].push(stream);
            return acc;
        }, {});

        // Print results by source
        Object.entries(sourceGroups).forEach(([source, sourceStreams]) => {
            console.log(`\n${source}:`);
            console.log(`Found ${sourceStreams.length} streams`);
            
            // Print first 3 streams as examples
            sourceStreams.slice(0, 3).forEach((stream, index) => {
                console.log(`\n${index + 1}. Stream Details:`);
                console.log(`Title: ${stream.filename}`);
                console.log(`Quality: ${stream.quality}`);
                console.log(`Size: ${stream.size}`);
                console.log(`Magnet: ${stream.magnetLink.substring(0, 60)}...`);
            });
        });

        // Test quality distribution
        const qualityDistribution = streams.reduce((acc, stream) => {
            acc[stream.quality] = (acc[stream.quality] || 0) + 1;
            return acc;
        }, {});

        console.log('\n📈 Quality Distribution:');
        Object.entries(qualityDistribution).forEach(([quality, count]) => {
            console.log(`${quality}: ${count} streams`);
        });

    } catch (error) {
        console.error('❌ Test failed:', error);
    }
}

// Run the test
console.log('🚀 Starting RSS Feed Test\n');
testRSSFeeds().then(() => {
    console.log('\n✅ Test completed');
}).catch(error => {
    console.error('\n❌ Test failed:', error);
});