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 functionality for users to select news articles by topic. #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

slryan09
Copy link

@slryan09 slryan09 commented Jun 6, 2018

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.

__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:
Copy link
Owner

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):

Copy link
Owner

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):

Copy link
Owner

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")
Copy link
Owner

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.

@Griffintaur Griffintaur self-requested a review October 4, 2018 12:16
@@ -14,6 +14,7 @@ def ExtractionAlgo(self,text):
def TextExtractionAlgo(self,text,htmlelement,classname):
soup=BeautifulSoup(text,'html.parser')
title=soup.title.string

Copy link
Owner

Choose a reason for hiding this comment

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

extra line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants