-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
64 lines (50 loc) · 1.27 KB
/
config.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
62
63
64
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: LiSnB
# @Date: 2015-10-09 19:02:15
# @Last Modified by: LiSnB
# @Last Modified time: 2015-10-13 16:30:08
import os
import logging
import re
import platform
system = platform.system().lower()
# root = os.getcwd()
root = os.path.split(os.path.realpath(__file__))[0]
level = {
'log': logging.INFO,
}
path = {
'db': os.path.join(root, 'mogujie.db'),
}
count = {
'mogu': 5,
}
switch = {
'mogucheckdup': True,
'mt': False
}
limit = {
'section': 20,
'singlepage': 9,
'mogudup': 10,
'singleitem': 5,
}
url = {
'detail': 'http://shop.mogujie.com/detailinfo/%s?_ajax=1',
'portalbook': 'http://www.mogujie.com/book/%s/%s',
'ajaxbook': 'http://www.mogujie.com/book/ajax',
}
header = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',
}
sleep = {
'short': [1, 5],
'long': [5, 10],
'long long': [10, 15],
}
regex = {
'profile': re.compile(r'MOGUPROFILE = [\w\W]+?book:"(?P<book>[^"]+?)"'),
'firstdata': re.compile(r'MoGu.APP.firstData = ((?P<firstdata>\[[\w\W]+?\]);)'),
}
logging.basicConfig(level = level['log'], format='%(asctime)s - %(levelname)s - %(threadName)-10s - %(message)s')