Skip to content

Commit ac41634

Browse files
Add files via upload
1 parent ada3561 commit ac41634

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Python_12_scrape_finance_news.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Created on Fri Dec 4 19:30:37 2020
4+
5+
@author: Tin
6+
"""
7+
# pip install newspaper3k
8+
import newspaper
9+
from newspaper import Article
10+
11+
url = "https://finance.yahoo.com/"
12+
13+
# download and parse article
14+
article = Article(url)
15+
article.download()
16+
article.parse()
17+
18+
# print article text
19+
print(article.text)
20+
21+
site = newspaper.build("https://finance.yahoo.com/")
22+
23+
# get list of article URLs
24+
print(site.article_urls())
25+

0 commit comments

Comments
 (0)