MCPcopy
hub / github.com/Jack-Cherish/python-spider / GetClass

Method GetClass

zhengfang_system_spider/spider.py:128–155  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

126 return True
127
128 def GetClass(self):
129 self.session.headers['Referer'] = self.baseurl + \
130 '/xs_main.aspx?xh=' + self.student.user
131 kburl = self.baseurl + '/xskbcx.aspx?xh='+self.student.user + \
132 '&xm='+self.student.urlname+'&gnmkdm=N121603'
133 kbresponse = self.session.get(kburl)
134 kbcont = kbresponse.text
135 pattern = re.compile('<td.*?align="Center".*?>(.*?)</td>', re.S)
136 contents = re.findall(pattern, kbcont)
137 tool = Tool()
138 f = open(os.getcwd()+'/zhengfang.txt', 'w')
139 f.write(u'本学期课表:'+'\n')
140 cnt = 1
141 l = [u'周一', u'周二', u'周三', u'周四', u'周五', u'周六', u'周日']
142 for day in l:
143 for i in contents:
144 if u'星期' in i:
145 continue
146 elif u'第' in i:
147 if day in i:
148 con = tool.replace(i)
149 f.write(str(cnt)+':\t'+con+'\n')
150 cnt += 1
151 else:
152 continue
153 f.write('\n')
154 f.close()
155 print('Download class succeed!')
156
157 def GetGrade(self):
158 self.session.headers['Referer'] = self.baseurl + \

Callers 1

spider.pyFile · 0.80

Calls 3

replaceMethod · 0.95
ToolClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected