-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
51 lines (41 loc) · 1.29 KB
/
main.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
47
48
49
50
51
import bs4
from bs4 import BeautifulSoup
from urllib.request import urlopen
import sys
import master
import os
def init():
print('Hii '+os.getlogin() + ' opening .... ')
if sys.argv.__len__() > 1:
first_option = sys.argv[1]
if first_option == '-c' or first_option == '-C':
print('You sre in customized mode ...')
print('This Customisation last only uptill current session.')
master.config.verboseCustomize()
else:
print('Invalid parameter specified')
# do not prompt for next jst do next
def main():
news_url = "http://news.google.com/news/rss"
client = urlopen(news_url)
page = client.read()
client.close()
soup_page = BeautifulSoup(page, "html.parser")
news_list = soup_page.findAll("item")
for news in news_list:
text = news.title.text
text += '\n'
f = open('news.txt', 'w')
f.write(text)
master.printNews(news)
if (master.config.autoPlay <= 0):
ch = input(
"Continue / GetMoreInfo / Exit [default: Continue] \n[c, i, e] : ")
if ch == 'e':
break
elif ch == 'i':
master.getMoreInfo(news)
if __name__ == '__main__':
init()
main()
print('\n\n'+'*'*5+'Done'+'*'*5)