-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwoqo.py
46 lines (40 loc) · 1.35 KB
/
woqo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/python
import subprocess
import requests
from subprocess import Popen
from datetime import date
from bs4 import BeautifulSoup
today = date.today()
quotes=[]
td = today.day
tm = today.month
ty = today.year
print(r'''
__ __ ___
\ \ / / ___ / _ \ ___
\ \ /\ / / / _ \ | | | | / _ \
\ V V / | (_) | | |_| | | (_) |
\_/\_/ \___/ \__\_\ \___/
@github.com/iam-shanmukha/
''')
### DICTIONARY.COM ###
word = "https://www.dictionary.com/e/word-of-the-day/"
word_page = requests.get(word)
word_soup = BeautifulSoup(word_page.content,'html.parser')
view_word = word_soup.find('title')
view_word_def = word_soup.find("div", {"class": "otd-item-headword__pos-blocks"})
### BRAINYQUOTE.COM ###
brainyquote = "https://www.brainyquote.com/quote_of_the_day"
brain_page = requests.get(brainyquote)
brain_soup = BeautifulSoup(brain_page.content, 'html.parser')
view_quote = brain_soup.find_all(title="view quote")
#class="otd-item-headword__pos-blocks"
print("########### WORD OF THE DAY - {}/{}/{} ###########\n".format(td,tm,ty))
print(view_word.string[18:-16].strip())
print(view_word_def.text.strip())
print()
print("########### QUOTE OF THE DAY - {}/{}/{} ###########\n".format(td,tm,ty))
for quote in view_quote:
quotes.append(quote.text)
print(quotes[1])
subprocess.Popen(['notify-send', quotes[1]])