-
Notifications
You must be signed in to change notification settings - Fork 53
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 functionality for users to select news articles by topic. #36
base: master
Are you sure you want to change the base?
Conversation
__Limit=None | ||
def __init__(self): | ||
with open("config.yml", 'r') as ymlfile: | ||
with open("/Users/Stormy/PycharmProjects/News-At-Command-Line/config.yml", 'r') as ymlfile: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not right. This path will not hold valid for every user. Thus not correct. The earlier one will search for config.yml in the present directory and make sure it is the relative path and not the full path..
@@ -11,14 +14,20 @@ | |||
import sys | |||
|
|||
class NewsPulling(object): | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extraline
# Pulls news stories based on SOURCE -- self.Source will indicate the correctly formatted | ||
# news source to be included in the URL | ||
def PullNews(self): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move the URL to the parameter of the class while stories or topic as input to the method based on which either it will fetch stories or topics. or if possible create an interface and then inherits different class both of which it will handle differently based on their use case.
while True: | ||
for i in xrange(len(newsTopics)): | ||
print ("[" + str(i) + "]" + "\t" + newsTopics[i]) | ||
print ("Please enter the index of the news topic") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move these print statement into some single function called disclaimer or anything that is intuitive.
@@ -14,6 +14,7 @@ def ExtractionAlgo(self,text): | |||
def TextExtractionAlgo(self,text,htmlelement,classname): | |||
soup=BeautifulSoup(text,'html.parser') | |||
title=soup.title.string | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra line
I added an additional option to let users choose to read the top stories based on category/topic. When they initially run the program, it will first ask whether they want to read articles based on topic or news source. If by news source, the program gives the original news source options to choose from. If by topic, the program gives a new menu to pick a topic.