Exemple #1
0
class Main(object):

    def __init__(self):
        self.mainspider = HustSpider()
        self.db = DB()

    def do(self,id):
        res = self.mainspider.get_info(id)
        if not res:
            self.mainspider = HustSpider()
            return
        res = HustParser(res)
        if res.name:
            self.db.insert_info(res)
        else:
            pass
        return 

    def run(self):

        for i in range(1,8000):
            i = str(i)
            while len(i)<4:
                i = '0'+i
            id = 'U20121'+i
            try:
                self.do(id)
            except:
                print(("#error:%s"%id))
                continue
Exemple #2
0
def main():
    S = HustSpider()
    D = DB()
    res = S.get_info('U201410001')
    res = HustParser(res)
    D.insert_info(res)
    print("end")