# python script to parte articles from Detroit, Chicago and Dallas news feeds
# must first install newspaper
# pip install newspaper#

# start exection of script
#parse-detroit-articles.py "https://detroitdaily.com/news/article/officer-shot

import sys
from newspaper import Article

url=sys.argv[1]
print("\n")
print("parse-news-article:",url)
print("\n")

#download and parse article
article=Article(url)
article.download()
article.parse()

#get output filename
fname=sys.argv[2]
sys.stdout=open(fname,"w")
#sys.stdout=open("article-context.txt","w")

#print text of article to a file
print(article.text)
sys.stdout.close()

#the end