MCPcopy
hub / github.com/luyishisi/Anti-Anti-Spider / main

Function main

原Anti-Anti-Spider/UrlSpider/model/UrlSpider.py:205–236  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

203
204
205def main():
206 global ErrorList, WarnList
207 connect, cursor = ConnectDB()
208
209 # 统计表总行数,依据flag = 3
210 try:
211 cursor.execute("SELECT COUNT(*) FROM %s WHERE flag = 3 ;" % Table)
212 except Exception, e:
213 print e
214 TaskNum = cursor.fetchall()
215 connect.close()
216
217 if TaskNum[0][0] == 0:
218 print "Warning:There is no need to do the task!!!"
219 else:
220 Total_TaskNum = int(TaskNum[0][0])
221 while True:
222 connect, cursor = ConnectDB() # 建立数据库连接
223 try:
224 if cursor.execute(select_sql % Table): # 取任务url
225 rows = cursor.fetchall()
226 Thread_Handle(rows, Total_TaskNum) # 线程启动
227 else:
228 break
229 except Exception, e:
230 print e
231 connect.close()
232 print "_____************_____"
233 if ErrorList:
234 for error in ErrorList:
235 print error
236 print "Error:", len(ErrorList), "Warning:", len(WarnList)
237
238if __name__ == '__main__':
239 print "The Program start time:", time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())

Callers 1

UrlSpider.pyFile · 0.70

Calls 2

ConnectDBFunction · 0.70
Thread_HandleFunction · 0.70

Tested by

no test coverage detected