-
Notifications
You must be signed in to change notification settings - Fork 2
/
conference.py
executable file
·65 lines (53 loc) · 1.83 KB
/
conference.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# -*- coding: utf-8 -*-
from urllib2 import *
from bs4 import BeautifulSoup
import threading
ConNameList = []
ConLocList = []
ConDateList = []
def init():
global ConNameList
ConNameList = []
global ConLocList
ConLocList = []
global ConDateList
ConDateList = []
#Crawling
url = "http://www.confsearch.org/confsearch/faces/pages/topic.jsp?topic=Security&sortMode=1&graphicView=0"
response = urlopen(url)
data = response.read()
soup = BeautifulSoup(data, "html5lib")
html_name = soup.find_all(class_="venueAlive venueKeywords")
for name in html_name:
ConNameList.append(name.string)
html_loc = soup.find_all(class_="locationColumn")
for loc in html_loc:
ConLocList.append(loc.span.string)
html_date = soup.find_all(class_="dateColumn")
index_couter = 0
templist = []
for dates in html_date:
templist.append(dates.span.string)
if index_couter%4 == 3:
ConDateList.append(templist)
templist = []
index_couter+=1
print len(ConNameList)
print len(ConLocList)
print len(ConDateList)
threading.Timer(7200, init).start()
def get_Confer_Info(Searchname=""):
#Some Constant
ENTERSTR = "\n"
RETURNSTR = ""
DEAD = 0
NOTI = 1
START = 2
END = 3
#List Search
for i in range(len(ConNameList)):
if ConNameList[i].lower().find(Searchname.lower()) >= 0:
RETURNSTR += str(ConNameList[i]) + " - Deadline: " + str(ConDateList[i][DEAD]) + ENTERSTR
return RETURNSTR
#initialize
init()