-
Notifications
You must be signed in to change notification settings - Fork 1
/
quanbenIniter.py
44 lines (34 loc) · 939 Bytes
/
quanbenIniter.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
#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''
@author: zyq
'''
import sys
import traceback
from app.QuanBenMianFeiCrawler import QuanBenCrawler
from app.mianfeiTXTNewFilder import findByIdRange
from util.logHelper import myLogging
def fromTopNBookIds():
fbids = open('top5wBookIds.txt')
bidsSet = set()
while 1:
bid = fbids.readline()
if not bid:
break
bid = bid.replace('\n', '')
bidsSet.add(bid)
print 'load to dict uniq ' + str(len(bidsSet))
for bid in bidsSet:
try:
QuanBenCrawler(bid).crawl(allowUpdate=False)
except Exception as e:
myLogging.error('bookId %s has exception: ' + traceback.format_exc(), bid)
if __name__ == '__main__':
fromTopNBookIds()
# st = 50000
# end = 500000
# if len(sys.argv) > 1:
# st = int(sys.argv[1])
# end = int(sys.argv[2])
#
# findByIdRange(st, end)