-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathzsb.py
61 lines (54 loc) · 1.48 KB
/
zsb.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
# -*- coding: utf-8 -*-
import re
import time
#import urllib
import urllib2
def zsb ():
m = re.findall(r"""news/user/News_Detail_use.asp
\S *
height=800,
\s
\S* #state
\s
\S* #menubar
\s
\S* #resizable
\s
\S* #scrollbars
\s
\S* #false
\s
\S* #target
\s
\S* #title
\s\S*\s*
</a>
\s*\S*
""", urllib2.urlopen("http://zsb.hit.edu.cn").read(), re.M|re.X)
#T = time.strftime('%m.%d', time.localtime(time.time()))
T = "9.29"
URL = []
Title = []
News = []
for i in m:
dat = i[-5:-1]
if(cmp(dat, T) != -1):
continue
d = T.replace('.', '-')
date = "2014/"
if(d[1] == '-'):date += "0"
date += d
print date
url = "http://zsb.hit.edu.cn/"
url += i[0:37]
cnt = URL.count(url)
if(cnt != 0):
continue
URL.append(url)
print url
l = i.split(">")
news = l[1][0:-3]
print news
News.append(url + "$" + news)
return News
zsb()