-
-
Notifications
You must be signed in to change notification settings - Fork 47k
added daily horoscope scrapper script #2167
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
Conversation
added daily horoscope scrapper script
Hey @Kim-R2O, TravisCI finished with status TravisBuddy Request Identifier: f840e210-bd70-11ea-ab91-9125a069a76b |
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.
Cool submission!, Lines 18-23 are the core of your algorithm so let’s put those lines into a function:
def horoscope(zodiac_sign: int, day: str = "today") -> str:
url = ('https://www.horoscope.com/us/horoscopes/general/'
f'horoscope-general-daily-{day}.aspx?sign={zodiac_sign}')
soup = BeautifulSoup(requests.get(url).content, 'html.parser')
return soup.find('div', class_= 'main-horoscope').p.text
Then move all the input() and print() code into __main__
. This would allow someone else to easily put your algorithm into a bigger project. print(horoscope(8))
web_programming/daily_horoscope.py
Outdated
import requests | ||
|
||
def horoscope(): | ||
print('Your daily Horoscope. \n') |
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.
According to CONTRIBUTING.md algorithm functions should not print()
code refactoring, script editing
* added daily horoscope scrapper * Update daily horoscope scrapper script code refactoring, script editing * Update web_programming/daily_horoscope.py Co-authored-by: Christian Clauss <cclauss@me.com>
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}
.