-
Notifications
You must be signed in to change notification settings - Fork 0
/
hello.py
50 lines (39 loc) · 1.2 KB
/
hello.py
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
from flask import Flask, render_template
from newspaper import Article
app = Flask(__name__)
@app.route('/')
def index():
return render_template('hola.html')
@app.route('/count/')
def count():
a = 20
print(a)
return ('a')
@app.route('/article/')
def article():
#A new article from TOI
url = "https://elpais.com/deportes/2023-02-16/el-fc-barcelona-pago-al-vicepresidente-de-arbitros-enriquez-negreira-siete-millones-desde-2001-por-supuestas-asesorias-verbales.html"
#For different language newspaper refer above table
toi_article = Article(url, language="en") # en for English
#To download the article
toi_article.download()
#To parse the article
toi_article.parse()
#To perform natural language processing ie..nlp
toi_article.nlp()
#To extract title
print("Article's Title:")
print(toi_article.title)
print("n")
#To extract text
print("Article's Text:")
print(toi_article.text)
print("n")
#To extract summary
print("Article's Summary:")
print(toi_article.summary)
print("n")
#To extract keywords
print("Article's Keywords:")
print(toi_article.keywords)
return(toi_article.title, 'hola hola!')