Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added colours to print for better readability #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added ExtractMainContent.pyc
Binary file not shown.
Binary file added Extractor.pyc
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this file required ?
what is this file. I think you have saved some article and just uploaded

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how that came. No, it's not required.
color_print doesn't work in IDLE. It will probably work in ubuntu shell. I don't have ubuntu so I can't test it.
And you can remove .pyc files.

Legendary entertainer and civil rights activist Harry Belafonte used his final public appearance to issue a warning about the future of the nation.
According to The Guardian, Belafonte, 90, said “the country made a mistake” when it elected Donald Trump as president. 



“I think the next mistake might very well be the gas chamber and what happened to Jews [under] Hitler is not too far from our door,” he was quoted as saying. 
Belafonte gave a wide-ranging talk at the Carnegie Music Hall in Pittsburgh on Friday about his life, his music and his decades-long fight for social justice.




He also sounded an optimistic note.  



“We have achieved a lot in my lifetime,” Belafonte said, per The Guardian. “Dr. King was not about nothing. Eleanor Roosevelt was not about nothing. I think in the final analysis that we shall overcome because what we did is … we left a harvest that generations to come [will] reap. That they have not yet plowed. That they have not yet harvested.”







Belafonte was the first African American to win an Emmy Award. “The King of Calypso” was also the recipient of several Grammys as well as a Tony. In 2014, he received the honorary Jean Hersholt Humanitarian Award at the Academy Awards. 
A member of the audience posted an audio recording of the Pittsburgh event: 
26 changes: 14 additions & 12 deletions Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from ExtractMainContent import ExtractMainContent
import sys
import codecs
from lazyme.string import color_print


def NewsSources():
Expand All @@ -19,39 +20,40 @@ def App():
newsSources=NewsSources()
while True:
for i in xrange(len(newsSources)):
print ("["+str(i)+"]" +"\t" +newsSources[i])
print ("Please enter the index of the news source or press 99 to quit")
color_print ("["+str(i)+"]" +"\t" +newsSources[i],color='yellow')
color_print ("Please enter the index of the news source or press 99 to quit", color='red')
try:
newsSourceNumber=raw_input("News Source Number >>>> ")
color_print("News Source Number >>>> ",color="red")
newsSourceNumber=raw_input()
except ValueError:
print ("That is not a valid News Source Number")
color_print ("That is not a valid News Source Number", color='red')
newsSourceNumber=int(newsSourceNumber)
if newsSourceNumber==99:
sys.exit()
if (newsSourceNumber >=len(newsSources)):
print ("Please select the index no less than "+ str(len(newsSources)))
color_print ("Please select the index no less than "+ str(len(newsSources)), color='red')
obj=NewsPulling(newsSources[newsSourceNumber])
Articles=obj.BeautifyArticles();
while True:
print ("Do you want to read any story further? If yes, please select the number corresponding to the article")
print ("Press 66 to go back to the main menu")
print ("Press 99 to quit")
color_print ("Do you want to read any story further? If yes, please select the number corresponding to the article", color='red')
color_print ("Press 66 to go back to the main menu", color='red')
color_print ("Press 99 to quit", color='red')
try:
articleNumber=raw_input("Article No >>>> ")
except ValueError:
print ("That is not a valid Article Number")
color_print ("That is not a valid Article Number", color='red')
articleNumber=int(articleNumber)
if articleNumber==99 :
sys.exit()
elif articleNumber==66 :
break
elif (articleNumber >= len(Articles)):
print ("Please select the index no less than "+ str(len(Articles)))
#print Articles[articleNumber][2]
color_print ("Please select the index no less than "+ str(len(Articles)), color='red')
#color_print Articles[articleNumber][2]
else:
extr=ExtractMainContent(newsSources[newsSourceNumber],Articles[articleNumber][2])
extr.Beautify()
print ("Do you want to save this article in file")
color_print ("Do you want to save this article in file", color='red')
YesorNo = int(raw_input("Press 1 to save else press 0 to continue >>> "))
if YesorNo == 1:
extr.FileSave()
Expand Down
7 changes: 4 additions & 3 deletions NewsPulling.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from configReader import ConfigurationReader
from requests import ConnectionError
import sys
from lazyme.string import color_print

class NewsPulling(object):
"""This class is used to pull news from the internet depending on the source specified """
Expand Down Expand Up @@ -73,9 +74,9 @@ def BeautifyArticles(self):
if self.Articles is None or len(self.Articles)==0:
print "No articles found"
sys.exit()
print "=================STORIES=================================="
color_print("=================STORIES==================================",color='cyan')
for i in xrange(len(self.Articles)):
print "[" +str(i) +"]",
color_print("[" +str(i) +"]",color='yellow')
# print(sequence,end='') used for python 3.x
if self.Articles[i][1] is not None:
print "\t"+self.Articles[i][1]
Expand All @@ -85,7 +86,7 @@ def BeautifyArticles(self):
print "\t"+self.Articles[i][4]
if self.Articles[i][3] is not None:
print "\t"+self.Articles[i][3]+"\n"
print "***************************************************************"
color_print("***************************************************************",color='cyan')
return self.Articles


Expand Down
Binary file added NewsPulling.pyc
Binary file not shown.
Binary file added configReader.pyc
Binary file not shown.