/
main.py
47 lines (35 loc) · 1.75 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
import MySQLdb
from crawler import *
if __name__ == '__main__':
crawl = crawler()
rep = 'Y'
while rep == 'y' or rep == 'Y':
print ""
print "-----------------------------------------------------------------------------"
print "1. Add New Website"
print "2. Delete Website"
print "3. Parse News (Just for Demo)"
print "4. Parse All News from existing xml(s)"
print "-----------------------------------------------------------------------------"
choice = int(raw_input("\t\t\t\tEnter Your Choice\n-----------------------------------------------------------------------------\n"))
print "-----------------------------------------------------------------------------"
if choice == 1:
link = raw_input('\t\t\t\tEnter a link\n-----------------------------------------------------------------------------\n')
crawl.add_web(link)
elif choice == 2:
link = raw_input('\t\t\t\tEnter a link\n-----------------------------------------------------------------------------\n')
crawl.delete_web(link)
elif choice == 3:
link = raw_input('\t\t\t\tEnter a link\n-----------------------------------------------------------------------------\n')
crawl.parse_one(link)
elif choice == 4:
crawl.parse_all()
else:
print "Bad Choice"
rep = raw_input("You Want to continue? (Y/N)")
print ""
print ""
print "-----------------------------------------------------------------------------"
print "\t\t\tThanks for using our crawler"
print "\t\t\t\tGoodbye :-)"
print "-----------------------------------------------------------------------------"