Abdullah6395's picture
edited file name
8343da6
raw
history blame contribute delete
671 Bytes
from textblob import TextBlob
from newspaper import Article
import nltk
nltk.download("punkt_tab")
from flask import Flask,render_template,request
app=Flask(__name__)
@app.route("/",methods=['GET'])
def search():
return render_template("index.html")
@app.route("/show",methods=["POST"])
def show():
url=request.form['link']
article=Article(url)
article.download()
article.parse()
article.nlp()
analysis=TextBlob(article.text)
data=[article.title,article.publish_date,article.authors,article.summary,article.keywords,analysis.polarity]
return render_template("index.html",data=data)
if __name__=="__main__":
app.run(debug=True)