File size: 908 Bytes
c3bf538
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from tools.news_tools import get_combined_news_and_sentiment_debug

def test_news():
    ticker = "RELIANCE.NS"
    company_name = "Reliance Industries"
    
    print(f"Testing news scraping for {ticker} ({company_name})")
    result = get_combined_news_and_sentiment_debug(ticker, company_name)
    
    print(f"\nResults:")
    print(f"Total articles: {result['sentiment_summary']['total_items']}")
    print(f"Positive: {result['sentiment_summary']['positive']}")
    print(f"Negative: {result['sentiment_summary']['negative']}")
    print(f"Neutral: {result['sentiment_summary']['neutral']}")
    
    if result['articles']:
        print(f"\nSample articles:")
        for i, article in enumerate(result['articles'][:3]):
            print(f"{i+1}. {article['title']}")
            print(f"   Source: {article['source']} | Sentiment: {article['sentiment']}")

if __name__ == "__main__":
    test_news()