Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,6 @@ import streamlit as st
|
|
| 2 |
import requests
|
| 3 |
from bs4 import BeautifulSoup
|
| 4 |
from transformers import pipeline
|
| 5 |
-
from bs4 import BeautifulSoup
|
| 6 |
|
| 7 |
# Initialize sentiment analysis pipeline
|
| 8 |
sentiment_pipeline = pipeline("sentiment-analysis")
|
|
@@ -11,7 +10,7 @@ sentiment_pipeline = pipeline("sentiment-analysis")
|
|
| 11 |
def fetch_news(ticker):
|
| 12 |
try:
|
| 13 |
url = f"https://finviz.com/quote.ashx?t={ticker}"
|
| 14 |
-
headers = {'User-Agent': 'Mozilla/5.0'}
|
| 15 |
response = requests.get(url, headers=headers)
|
| 16 |
soup = BeautifulSoup(response.text, 'html.parser')
|
| 17 |
news_table = soup.find(id='news-table')
|
|
|
|
| 2 |
import requests
|
| 3 |
from bs4 import BeautifulSoup
|
| 4 |
from transformers import pipeline
|
|
|
|
| 5 |
|
| 6 |
# Initialize sentiment analysis pipeline
|
| 7 |
sentiment_pipeline = pipeline("sentiment-analysis")
|
|
|
|
| 10 |
def fetch_news(ticker):
|
| 11 |
try:
|
| 12 |
url = f"https://finviz.com/quote.ashx?t={ticker}"
|
| 13 |
+
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'}
|
| 14 |
response = requests.get(url, headers=headers)
|
| 15 |
soup = BeautifulSoup(response.text, 'html.parser')
|
| 16 |
news_table = soup.find(id='news-table')
|