├── 1.xls ├── 2.py ├── apiStudy.log ├── apiStudy.py ├── config.py ├── decrypt.js ├── proxy.py ├── temp └── 1.xls ├── usually_data.py ├── utils.py └── yue.xls /1.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Crack-DanShiFu/apiStudy/10d40cbdcadbad559d7f7ccd21734db658cc27b7/1.xls -------------------------------------------------------------------------------- /2.py: -------------------------------------------------------------------------------- 1 | import gzip 2 | import json 3 | import os 4 | from queue import Queue 5 | 6 | import openpyxl 7 | import requests 8 | from lxml import etree 9 | from openpyxl.cell.cell import ILLEGAL_CHARACTERS_RE 10 | 11 | 12 | def get_region_and_filtvalue(): 13 | html_info = requests.get('http://www.cpppc.org:8086/pppcentral/map/toPPPList.do') 14 | html = etree.HTML(html_info.text) 15 | region_items = html.xpath('//div[@class="v-fold"]/ul[@class="l-list1"]//a/text()')[3:-20] 16 | filtvalue_items = html.xpath('//div[@class="v-fold"]/ul[@class="l-list1"]//a/@filtvalue')[3:-20] 17 | for k, v in enumerate(region_items): 18 | region_items[k] = str(v).strip() 19 | items = dict(zip(region_items, filtvalue_items)) 20 | return items 21 | 22 | 23 | def get_project_details(PROJ_RID): 24 | url = 'http://www.cpppc.org:8083/efmisweb/ppp/projectLibrary/getProjInfoNational.do?projId=' + PROJ_RID 25 | html_info = requests.get(url) 26 | html = etree.HTML(html_info.text) 27 | details_items = html.xpath('//div[@class="margin"]/table//td[@colspan="5"]/text()') 28 | social_capital_items = html.xpath('//div[@id="con_ss_1"]/div/table[1]/tbody/tr[4]/td[2]/text()') 29 | ESTIMATE_COPER_items = html.xpath('//div[@id="con_ss_1"]/div/table[1]/tbody/tr[3]/td[2]/text()') 30 | print(ESTIMATE_COPER_items) 31 | return {'Project_demonstration_level': ''.join(details_items), 32 | 'Ways_of_purchasing_social_capital': ''.join(social_capital_items), 33 | 'ESTIMATE_COPER': ''.join(ESTIMATE_COPER_items)} 34 | 35 | 36 | def get_project_list_by_region(distStr): 37 | url = 'http://www.cpppc.org:8086/pppcentral/map/getPPPList.do' 38 | params = { 39 | 'queryPage': '1', 40 | 'distStr': distStr, 41 | 'projStateType': '1' 42 | } 43 | html_info = requests.get(url, params=params).content 44 | json_info = json.loads(html_info) 45 | totalPage = json_info['totalPage'] 46 | project_list = [] 47 | if totalPage: 48 | for i in range(int(totalPage)): 49 | params['queryPage'] = i + 1 50 | html_info = requests.get(url, params=params).content 51 | json_info = json.loads(html_info) 52 | project_list.extend(json_info['list']) 53 | print('爬取' + str(distStr) + '') 54 | for k, v in enumerate(project_list): 55 | Project_demonstration_level = get_project_details(v['PROJ_RID']) 56 | project_list[k]['Project_demonstration_level'] = Project_demonstration_level['Project_demonstration_level'] 57 | project_list[k]['ESTIMATE_COPER'] = Project_demonstration_level['ESTIMATE_COPER'] 58 | project_list[k]['Ways_of_purchasing_social_capital'] = Project_demonstration_level[ 59 | 'Ways_of_purchasing_social_capital'] 60 | print('爬取' + str(distStr) + project_list[k]['PROJ_NAME'] + '详细信息') 61 | return project_list 62 | 63 | 64 | def write_excel(title, distStr): 65 | if not os.path.exists('region.xlsx'): 66 | wb = openpyxl.Workbook() 67 | wb.save("region.xlsx") 68 | info = get_project_list_by_region(distStr) 69 | wb = openpyxl.load_workbook('region.xlsx') 70 | ws = wb.create_sheet(title=title) 71 | title = ['PROJ_NAME', 'PRV', 'IVALUE', 'INVESTCOUNT', 'PROJ_STATE_NAME', 'START_TIME', 72 | 'Project_demonstration_level', 'RETURN_MODE_NAME', 'ESTIMATE_COPER', 'OPERATE_MODE_NAME', 73 | 'Ways_of_purchasing_social_capital'] 74 | ws.append(title) 75 | for i in info: 76 | cell_info = [] 77 | for t in title: 78 | text = ILLEGAL_CHARACTERS_RE.sub(r'', str(i[t])) 79 | cell_info.append(text) 80 | print(cell_info) 81 | ws.append(cell_info) 82 | wb.save("region.xlsx") 83 | 84 | 85 | if __name__ == '__main__': 86 | prv = get_region_and_filtvalue() 87 | print(prv) 88 | # prv_queue = Queue() 89 | # 90 | # for i in prv: 91 | # prv_queue.put(i) 92 | # treading_list=[] 93 | # for i in range(8): 94 | # treading_list.append(treading.Thread(target=write_excel(),args = ())) 95 | 96 | for p in prv: 97 | write_excel(p, prv[p]) 98 | -------------------------------------------------------------------------------- /apiStudy.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Crack-DanShiFu/apiStudy/10d40cbdcadbad559d7f7ccd21734db658cc27b7/apiStudy.log -------------------------------------------------------------------------------- /apiStudy.py: -------------------------------------------------------------------------------- 1 | import threading 2 | from queue import Queue 3 | from proxy import get_proxy 4 | # 获取一个城市所有的历史数据 by lczCrack qq1124241615 5 | # 加密参数 6 | from utils import * 7 | 8 | 9 | # 爬虫的线程对象 10 | class AQIThread(threading.Thread): 11 | def __init__(self, threadID, city_queue): 12 | threading.Thread.__init__(self) 13 | self.threadID = threadID 14 | self.city_queue = city_queue 15 | self.singal = threading.Event() 16 | self.singal.set() 17 | 18 | def run(self): 19 | while not self.city_queue.empty(): 20 | ci = self.city_queue.get() 21 | result = get_all_info_by_city(city=ci) 22 | print(result) 23 | #insert_month_db(result) 24 | # insert_db(result) 25 | # write_excel(result, ci) 26 | 27 | def pause(self): 28 | self.log_ctrl.AppendText("pause\n") 29 | self.singal.clear() 30 | 31 | def restart(self): 32 | self.log_ctrl.AppendText("continue\n") 33 | self.singal.set() 34 | 35 | 36 | if __name__ == '__main__': 37 | city_queue = Queue() 38 | citys = get_city() 39 | 40 | for i in citys: 41 | city_queue.put(i) 42 | 43 | threads = [AQIThread(i, city_queue) for i in range(num_of_threads)] 44 | for i in range(num_of_threads): 45 | threads[i].start() 46 | -------------------------------------------------------------------------------- /config.py: -------------------------------------------------------------------------------- 1 | num_of_threads = 10 2 | data_url = 'https://www.aqistudy.cn/historydata/api/historyapi.php' 3 | city_url = 'https://www.aqistudy.cn/historydata/' 4 | LOG_FORMAT = "%(asctime)s - %(levelname)s - %(message)s" 5 | DATE_FORMAT = "%m/%d/%Y %H:%M:%S %p" -------------------------------------------------------------------------------- /decrypt.js: -------------------------------------------------------------------------------- 1 | function Base64() { 2 | _2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", 3 | this.encode = function (a) { 4 | var c, d, e, f, g, h, i, b = "", 5 | j = 0; 6 | for (a = _29(a); j < a.length;) c = a.charCodeAt(j++), 7 | d = a.charCodeAt(j++), 8 | e = a.charCodeAt(j++), 9 | f = c >> 2, 10 | g = (3 & c) << 4 | d >> 4, 11 | h = (15 & d) << 2 | e >> 6, 12 | i = 63 & e, 13 | isNaN(d) ? h = i = 64 : isNaN(e) && (i = 64), 14 | b = b + _2.charAt(f) + _2.charAt(g) + _2.charAt(h) + _2.charAt(i); 15 | return b 16 | }, 17 | this.decode = function (a) { 18 | var c, d, e, f, g, h, i, b = "", 19 | j = 0; 20 | for (a = a.replace(/[^A-Za-z0-9\+\/\=]/g, ""); j < a.length;) f = _2.indexOf(a.charAt(j++)), 21 | g = _2.indexOf(a.charAt(j++)), 22 | h = _2.indexOf(a.charAt(j++)), 23 | i = _2.indexOf(a.charAt(j++)), 24 | c = f << 2 | g >> 4, 25 | d = (15 & g) << 4 | h >> 2, 26 | e = (3 & h) << 6 | i, 27 | b += String.fromCharCode(c), 28 | 64 != h && (b += String.fromCharCode(d)), 29 | 64 != i && (b += String.fromCharCode(e)); 30 | return b = _27(b) 31 | }, 32 | _29 = function (a) { 33 | var b, c, d; 34 | for (a = a.replace(/\r\n/g, "\n"), b = "", c = 0; c < a.length; c++) d = a.charCodeAt(c), 35 | 128 > d ? b += String.fromCharCode(d) : d > 127 && 2048 > d ? (b += String.fromCharCode(192 | d >> 6), b += String.fromCharCode(128 | 63 & d)) : (b += String.fromCharCode(224 | d >> 12), b += String.fromCharCode(128 | 63 & d >> 6), b += String.fromCharCode(128 | 63 & d)); 36 | return b 37 | }, 38 | _27 = function (a) { 39 | for (var b = "", c = 0, d = c1 = c2 = 0; c < a.length;) d = a.charCodeAt(c), 40 | 128 > d ? (b += String.fromCharCode(d), c++) : d > 191 && 224 > d ? (c2 = a.charCodeAt(c + 1), b += String.fromCharCode((31 & d) << 6 | 63 & c2), c += 2) : (c2 = a.charCodeAt(c + 1), c3 = a.charCodeAt(c + 2), b += String.fromCharCode((15 & d) << 12 | (63 & c2) << 6 | 63 & c3), c += 3); 41 | return b 42 | } 43 | } 44 | function hex_md5(a) { 45 | return binl2hex(core_md5(str2binl(a), a.length * chrsz)) 46 | } 47 | function b64_md5(a) { 48 | return binl2b64(core_md5(str2binl(a), a.length * chrsz)) 49 | } 50 | function str_md5(a) { 51 | return binl2str(core_md5(str2binl(a), a.length * chrsz)) 52 | } 53 | function hex_hmac_md5(a, b) { 54 | return binl2hex(core_hmac_md5(a, b)) 55 | } 56 | function b64_hmac_md5(a, b) { 57 | return binl2b64(core_hmac_md5(a, b)) 58 | } 59 | function str_hmac_md5(a, b) { 60 | return binl2str(core_hmac_md5(a, b)) 61 | } 62 | function md5_vm_test() { 63 | return "900150983cd24fb0d6963f7d28e17f72" == hex_md5("abc") 64 | } 65 | function core_md5(a, b) { 66 | var c, d, e, f, g, h, i, j, k; 67 | for (a[b >> 5] |= 128 << b % 32, a[(b + 64 >>> 9 << 4) + 14] = b, c = 1732584193, d = -271733879, e = -1732584194, f = 271733878, g = 0; g < a.length; g += 16) h = c, 68 | i = d, 69 | j = e, 70 | k = f, 71 | c = md5_ff(c, d, e, f, a[g + 0], 7, -680876936), 72 | f = md5_ff(f, c, d, e, a[g + 1], 12, -389564586), 73 | e = md5_ff(e, f, c, d, a[g + 2], 17, 606105819), 74 | d = md5_ff(d, e, f, c, a[g + 3], 22, -1044525330), 75 | c = md5_ff(c, d, e, f, a[g + 4], 7, -176418897), 76 | f = md5_ff(f, c, d, e, a[g + 5], 12, 1200080426), 77 | e = md5_ff(e, f, c, d, a[g + 6], 17, -1473231341), 78 | d = md5_ff(d, e, f, c, a[g + 7], 22, -45705983), 79 | c = md5_ff(c, d, e, f, a[g + 8], 7, 1770035416), 80 | f = md5_ff(f, c, d, e, a[g + 9], 12, -1958414417), 81 | e = md5_ff(e, f, c, d, a[g + 10], 17, -42063), 82 | d = md5_ff(d, e, f, c, a[g + 11], 22, -1990404162), 83 | c = md5_ff(c, d, e, f, a[g + 12], 7, 1804603682), 84 | f = md5_ff(f, c, d, e, a[g + 13], 12, -40341101), 85 | e = md5_ff(e, f, c, d, a[g + 14], 17, -1502002290), 86 | d = md5_ff(d, e, f, c, a[g + 15], 22, 1236535329), 87 | c = md5_gg(c, d, e, f, a[g + 1], 5, -165796510), 88 | f = md5_gg(f, c, d, e, a[g + 6], 9, -1069501632), 89 | e = md5_gg(e, f, c, d, a[g + 11], 14, 643717713), 90 | d = md5_gg(d, e, f, c, a[g + 0], 20, -373897302), 91 | c = md5_gg(c, d, e, f, a[g + 5], 5, -701558691), 92 | f = md5_gg(f, c, d, e, a[g + 10], 9, 38016083), 93 | e = md5_gg(e, f, c, d, a[g + 15], 14, -660478335), 94 | d = md5_gg(d, e, f, c, a[g + 4], 20, -405537848), 95 | c = md5_gg(c, d, e, f, a[g + 9], 5, 568446438), 96 | f = md5_gg(f, c, d, e, a[g + 14], 9, -1019803690), 97 | e = md5_gg(e, f, c, d, a[g + 3], 14, -187363961), 98 | d = md5_gg(d, e, f, c, a[g + 8], 20, 1163531501), 99 | c = md5_gg(c, d, e, f, a[g + 13], 5, -1444681467), 100 | f = md5_gg(f, c, d, e, a[g + 2], 9, -51403784), 101 | e = md5_gg(e, f, c, d, a[g + 7], 14, 1735328473), 102 | d = md5_gg(d, e, f, c, a[g + 12], 20, -1926607734), 103 | c = md5_hh(c, d, e, f, a[g + 5], 4, -378558), 104 | f = md5_hh(f, c, d, e, a[g + 8], 11, -2022574463), 105 | e = md5_hh(e, f, c, d, a[g + 11], 16, 1839030562), 106 | d = md5_hh(d, e, f, c, a[g + 14], 23, -35309556), 107 | c = md5_hh(c, d, e, f, a[g + 1], 4, -1530992060), 108 | f = md5_hh(f, c, d, e, a[g + 4], 11, 1272893353), 109 | e = md5_hh(e, f, c, d, a[g + 7], 16, -155497632), 110 | d = md5_hh(d, e, f, c, a[g + 10], 23, -1094730640), 111 | c = md5_hh(c, d, e, f, a[g + 13], 4, 681279174), 112 | f = md5_hh(f, c, d, e, a[g + 0], 11, -358537222), 113 | e = md5_hh(e, f, c, d, a[g + 3], 16, -722521979), 114 | d = md5_hh(d, e, f, c, a[g + 6], 23, 76029189), 115 | c = md5_hh(c, d, e, f, a[g + 9], 4, -640364487), 116 | f = md5_hh(f, c, d, e, a[g + 12], 11, -421815835), 117 | e = md5_hh(e, f, c, d, a[g + 15], 16, 530742520), 118 | d = md5_hh(d, e, f, c, a[g + 2], 23, -995338651), 119 | c = md5_ii(c, d, e, f, a[g + 0], 6, -198630844), 120 | f = md5_ii(f, c, d, e, a[g + 7], 10, 1126891415), 121 | e = md5_ii(e, f, c, d, a[g + 14], 15, -1416354905), 122 | d = md5_ii(d, e, f, c, a[g + 5], 21, -57434055), 123 | c = md5_ii(c, d, e, f, a[g + 12], 6, 1700485571), 124 | f = md5_ii(f, c, d, e, a[g + 3], 10, -1894986606), 125 | e = md5_ii(e, f, c, d, a[g + 10], 15, -1051523), 126 | d = md5_ii(d, e, f, c, a[g + 1], 21, -2054922799), 127 | c = md5_ii(c, d, e, f, a[g + 8], 6, 1873313359), 128 | f = md5_ii(f, c, d, e, a[g + 15], 10, -30611744), 129 | e = md5_ii(e, f, c, d, a[g + 6], 15, -1560198380), 130 | d = md5_ii(d, e, f, c, a[g + 13], 21, 1309151649), 131 | c = md5_ii(c, d, e, f, a[g + 4], 6, -145523070), 132 | f = md5_ii(f, c, d, e, a[g + 11], 10, -1120210379), 133 | e = md5_ii(e, f, c, d, a[g + 2], 15, 718787259), 134 | d = md5_ii(d, e, f, c, a[g + 9], 21, -343485551), 135 | c = safe_add(c, h), 136 | d = safe_add(d, i), 137 | e = safe_add(e, j), 138 | f = safe_add(f, k); 139 | return Array(c, d, e, f) 140 | } 141 | function md5_cmn(a, b, c, d, e, f) { 142 | return safe_add(bit_rol(safe_add(safe_add(b, a), safe_add(d, f)), e), c) 143 | } 144 | function md5_ff(a, b, c, d, e, f, g) { 145 | return md5_cmn(b & c | ~b & d, a, b, e, f, g) 146 | } 147 | function md5_gg(a, b, c, d, e, f, g) { 148 | return md5_cmn(b & d | c & ~d, a, b, e, f, g) 149 | } 150 | function md5_hh(a, b, c, d, e, f, g) { 151 | return md5_cmn(b ^ c ^ d, a, b, e, f, g) 152 | } 153 | function md5_ii(a, b, c, d, e, f, g) { 154 | return md5_cmn(c ^ (b | ~d), a, b, e, f, g) 155 | } 156 | function core_hmac_md5(a, b) { 157 | var d, e, f, g, c = str2binl(a); 158 | for (c.length > 16 && (c = core_md5(c, a.length * chrsz)), d = Array(16), e = Array(16), f = 0; 16 > f; f++) d[f] = 909522486 ^ c[f], 159 | e[f] = 1549556828 ^ c[f]; 160 | return g = core_md5(d.concat(str2binl(b)), 512 + b.length * chrsz), 161 | core_md5(e.concat(g), 640) 162 | } 163 | function safe_add(a, b) { 164 | var c = (65535 & a) + (65535 & b), 165 | d = (a >> 16) + (b >> 16) + (c >> 16); 166 | return d << 16 | 65535 & c 167 | } 168 | function bit_rol(a, b) { 169 | return a << b | a >>> 32 - b 170 | } 171 | function str2binl(a) { 172 | var d, b = Array(), 173 | c = (1 << chrsz) - 1; 174 | for (d = 0; d < a.length * chrsz; d += chrsz) b[d >> 5] |= (a.charCodeAt(d / chrsz) & c) << d % 32; 175 | return b 176 | } 177 | function binl2str(a) { 178 | var d, b = "", 179 | c = (1 << chrsz) - 1; 180 | for (d = 0; d < 32 * a.length; d += chrsz) b += String.fromCharCode(a[d >> 5] >>> d % 32 & c); 181 | return b 182 | } 183 | function binl2hex(a) { 184 | var d, b = hexcase ? "0123456789ABCDEF" : "0123456789abcdef", 185 | c = ""; 186 | for (d = 0; d < 4 * a.length; d++) c += b.charAt(15 & a[d >> 2] >> 8 * (d % 4) + 4) + b.charAt(15 & a[d >> 2] >> 8 * (d % 4)); 187 | return c 188 | } 189 | function binl2b64(a) { 190 | var d, e, f, b = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", 191 | c = ""; 192 | for (d = 0; d < 4 * a.length; d += 3) for (e = (255 & a[d >> 2] >> 8 * (d % 4)) << 16 | (255 & a[d + 1 >> 2] >> 8 * ((d + 1) % 4)) << 8 | 255 & a[d + 2 >> 2] >> 8 * ((d + 2) % 4), f = 0; 4 > f; f++) c += 8 * d + 6 * f > 32 * a.length ? b64pad : b.charAt(63 & e >> 6 * (3 - f)); 193 | return c 194 | } 195 | function encode_param(a) { 196 | var b = new Base64; 197 | return b.encode(a) 198 | } 199 | function encode_secret() { 200 | var b, a = appId; 201 | for (b = 0; b < arguments.length; b++) a += arguments[b]; 202 | return a = a.replace(/\s/g, ""), 203 | hex_md5(a) 204 | } 205 | function decode_result(a) { 206 | var b = new Base64; 207 | return b.decode(b.decode(b.decode(a))) 208 | } 209 | var hexcase = 0, 210 | b64pad = "", 211 | chrsz = 8, 212 | appId = "b73a4aaa989f54997ef7b9c42b6b4b29"; 213 | var hexcase = 0; 214 | var b64pad = ""; 215 | 216 | function hex_md5(s) { 217 | return rstr2hex(rstr_md5(str2rstr_utf8(s))) 218 | } 219 | function b64_md5(s) { 220 | return rstr2b64(rstr_md5(str2rstr_utf8(s))) 221 | } 222 | function any_md5(s, e) { 223 | return rstr2any(rstr_md5(str2rstr_utf8(s)), e) 224 | } 225 | function hex_hmac_md5(k, d) { 226 | return rstr2hex(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d))) 227 | } 228 | function b64_hmac_md5(k, d) { 229 | return rstr2b64(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d))) 230 | } 231 | function any_hmac_md5(k, d, e) { 232 | return rstr2any(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d)), e) 233 | } 234 | function md5_vm_test() { 235 | return hex_md5("abc").toLowerCase() == "900150983cd24fb0d6963f7d28e17f72" 236 | } 237 | function rstr_md5(s) { 238 | return binl2rstr(binl_md5(rstr2binl(s), s.length * 8)) 239 | } 240 | function rstr_hmac_md5(key, data) { 241 | var bkey = rstr2binl(key); 242 | if (bkey.length > 16) bkey = binl_md5(bkey, key.length * 8); 243 | var ipad = Array(16), 244 | opad = Array(16); 245 | for (var i = 0; i < 16; i++) { 246 | ipad[i] = bkey[i] ^ 0x36363636; 247 | opad[i] = bkey[i] ^ 0x5C5C5C5C 248 | } 249 | var hash = binl_md5(ipad.concat(rstr2binl(data)), 512 + data.length * 8); 250 | return binl2rstr(binl_md5(opad.concat(hash), 512 + 128)) 251 | } 252 | function rstr2hex(input) { 253 | try { 254 | hexcase 255 | } catch (e) { 256 | hexcase = 0 257 | } 258 | var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; 259 | var output = ""; 260 | var x; 261 | for (var i = 0; i < input.length; i++) { 262 | x = input.charCodeAt(i); 263 | output += hex_tab.charAt((x >>> 4) & 0x0F) + hex_tab.charAt(x & 0x0F) 264 | } 265 | return output 266 | } 267 | function rstr2b64(input) { 268 | try { 269 | b64pad 270 | } catch (e) { 271 | b64pad = '' 272 | } 273 | var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 274 | var output = ""; 275 | var len = input.length; 276 | for (var i = 0; i < len; i += 3) { 277 | var triplet = (input.charCodeAt(i) << 16) | (i + 1 < len ? input.charCodeAt(i + 1) << 8 : 0) | (i + 2 < len ? input.charCodeAt(i + 2) : 0); 278 | for (var j = 0; j < 4; j++) { 279 | if (i * 8 + j * 6 > input.length * 8) output += b64pad; 280 | else output += tab.charAt((triplet >>> 6 * (3 - j)) & 0x3F) 281 | } 282 | } 283 | return output 284 | } 285 | function rstr2any(input, encoding) { 286 | var divisor = encoding.length; 287 | var i, j, q, x, quotient; 288 | var dividend = Array(Math.ceil(input.length / 2)); 289 | for (i = 0; i < dividend.length; i++) { 290 | dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1) 291 | } 292 | var full_length = Math.ceil(input.length * 8 / (Math.log(encoding.length) / Math.log(2))); 293 | var remainders = Array(full_length); 294 | for (j = 0; j < full_length; j++) { 295 | quotient = Array(); 296 | x = 0; 297 | for (i = 0; i < dividend.length; i++) { 298 | x = (x << 16) + dividend[i]; 299 | q = Math.floor(x / divisor); 300 | x -= q * divisor; 301 | if (quotient.length > 0 || q > 0) quotient[quotient.length] = q 302 | } 303 | remainders[j] = x; 304 | dividend = quotient 305 | } 306 | var output = ""; 307 | for (i = remainders.length - 1; i >= 0; i--) output += encoding.charAt(remainders[i]); 308 | return output 309 | } 310 | function str2rstr_utf8(input) { 311 | var output = ""; 312 | var i = -1; 313 | var x, y; 314 | while (++i < input.length) { 315 | x = input.charCodeAt(i); 316 | y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0; 317 | if (0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF) { 318 | x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF); 319 | i++ 320 | } 321 | if (x <= 0x7F) output += String.fromCharCode(x); 322 | else if (x <= 0x7FF) output += String.fromCharCode(0xC0 | ((x >>> 6) & 0x1F), 0x80 | (x & 0x3F)); 323 | else if (x <= 0xFFFF) output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F), 0x80 | ((x >>> 6) & 0x3F), 0x80 | (x & 0x3F)); 324 | else if (x <= 0x1FFFFF) output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07), 0x80 | ((x >>> 12) & 0x3F), 0x80 | ((x >>> 6) & 0x3F), 0x80 | (x & 0x3F)) 325 | } 326 | return output 327 | } 328 | function str2rstr_utf16le(input) { 329 | var output = ""; 330 | for (var i = 0; i < input.length; i++) output += String.fromCharCode(input.charCodeAt(i) & 0xFF, (input.charCodeAt(i) >>> 8) & 0xFF); 331 | return output 332 | } 333 | function str2rstr_utf16be(input) { 334 | var output = ""; 335 | for (var i = 0; i < input.length; i++) output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF, input.charCodeAt(i) & 0xFF); 336 | return output 337 | } 338 | function rstr2binl(input) { 339 | var output = Array(input.length >> 2); 340 | for (var i = 0; i < output.length; i++) output[i] = 0; 341 | for (var i = 0; i < input.length * 8; i += 8) output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (i % 32); 342 | return output 343 | } 344 | function binl2rstr(input) { 345 | var output = ""; 346 | for (var i = 0; i < input.length * 32; i += 8) output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xFF); 347 | return output 348 | } 349 | function binl_md5(x, len) { 350 | x[len >> 5] |= 0x80 << ((len) % 32); 351 | x[(((len + 64) >>> 9) << 4) + 14] = len; 352 | var a = 1732584193; 353 | var b = -271733879; 354 | var c = -1732584194; 355 | var d = 271733878; 356 | for (var i = 0; i < x.length; i += 16) { 357 | var olda = a; 358 | var oldb = b; 359 | var oldc = c; 360 | var oldd = d; 361 | a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936); 362 | d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586); 363 | c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819); 364 | b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330); 365 | a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897); 366 | d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426); 367 | c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341); 368 | b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983); 369 | a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416); 370 | d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417); 371 | c = md5_ff(c, d, a, b, x[i + 10], 17, -42063); 372 | b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162); 373 | a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682); 374 | d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101); 375 | c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290); 376 | b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329); 377 | a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510); 378 | d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632); 379 | c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713); 380 | b = md5_gg(b, c, d, a, x[i + 0], 20, -373897302); 381 | a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691); 382 | d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083); 383 | c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335); 384 | b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848); 385 | a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438); 386 | d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690); 387 | c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961); 388 | b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501); 389 | a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467); 390 | d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784); 391 | c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473); 392 | b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734); 393 | a = md5_hh(a, b, c, d, x[i + 5], 4, -378558); 394 | d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463); 395 | c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562); 396 | b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556); 397 | a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060); 398 | d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353); 399 | c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632); 400 | b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640); 401 | a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174); 402 | d = md5_hh(d, a, b, c, x[i + 0], 11, -358537222); 403 | c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979); 404 | b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189); 405 | a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487); 406 | d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835); 407 | c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520); 408 | b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651); 409 | a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844); 410 | d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415); 411 | c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905); 412 | b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055); 413 | a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571); 414 | d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606); 415 | c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523); 416 | b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799); 417 | a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359); 418 | d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744); 419 | c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380); 420 | b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649); 421 | a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070); 422 | d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379); 423 | c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259); 424 | b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551); 425 | a = safe_add(a, olda); 426 | b = safe_add(b, oldb); 427 | c = safe_add(c, oldc); 428 | d = safe_add(d, oldd) 429 | } 430 | return Array(a, b, c, d) 431 | } 432 | function md5_cmn(q, a, b, x, s, t) { 433 | return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b) 434 | } 435 | function md5_ff(a, b, c, d, x, s, t) { 436 | return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t) 437 | } 438 | function md5_gg(a, b, c, d, x, s, t) { 439 | return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t) 440 | } 441 | function md5_hh(a, b, c, d, x, s, t) { 442 | return md5_cmn(b ^ c ^ d, a, b, x, s, t) 443 | } 444 | function md5_ii(a, b, c, d, x, s, t) { 445 | return md5_cmn(c ^ (b | (~d)), a, b, x, s, t) 446 | } 447 | function safe_add(x, y) { 448 | var lsw = (x & 0xFFFF) + (y & 0xFFFF); 449 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16); 450 | return (msw << 16) | (lsw & 0xFFFF) 451 | } 452 | function bit_rol(num, cnt) { 453 | return (num << cnt) | (num >>> (32 - cnt)) 454 | } 455 | var CryptoJS = CryptoJS || 456 | function (h, r) { 457 | var k = {}, 458 | l = k.lib = {}, 459 | n = function () {}, 460 | f = l.Base = { 461 | extend: function (a) { 462 | n.prototype = this; 463 | var b = new n; 464 | a && b.mixIn(a); 465 | b.hasOwnProperty("init") || (b.init = function () { 466 | b.s.init.apply(this, arguments) 467 | }); 468 | b.init.prototype = b; 469 | b.s = this; 470 | return b 471 | }, 472 | create: function () { 473 | var a = this.extend(); 474 | a.init.apply(a, arguments); 475 | return a 476 | }, 477 | init: function () {}, 478 | mixIn: function (a) { 479 | for (var b in a) a.hasOwnProperty(b) && (this[b] = a[b]); 480 | a.hasOwnProperty("toString") && (this.toString = a.toString) 481 | }, 482 | clone: function () { 483 | return this.init.prototype.extend(this) 484 | } 485 | }, 486 | j = l.WordArray = f.extend({ 487 | init: function (a, b) { 488 | a = this.words = a || []; 489 | this.sigBytes = b != r ? b : 4 * a.length 490 | }, 491 | toString: function (a) { 492 | return (a || s).stringify(this) 493 | }, 494 | concat: function (a) { 495 | var b = this.words, 496 | d = a.words, 497 | c = this.sigBytes; 498 | a = a.sigBytes; 499 | this.clamp(); 500 | if (c % 4) for (var e = 0; e < a; e++) b[c + e >>> 2] |= (d[e >>> 2] >>> 24 - 8 * (e % 4) & 255) << 24 - 8 * ((c + e) % 4); 501 | else if (65535 < d.length) for (e = 0; e < a; e += 4) b[c + e >>> 2] = d[e >>> 2]; 502 | else b.push.apply(b, d); 503 | this.sigBytes += a; 504 | return this 505 | }, 506 | clamp: function () { 507 | var a = this.words, 508 | b = this.sigBytes; 509 | a[b >>> 2] &= 4294967295 << 32 - 8 * (b % 4); 510 | a.length = h.ceil(b / 4) 511 | }, 512 | clone: function () { 513 | var a = f.clone.call(this); 514 | a.words = this.words.slice(0); 515 | return a 516 | }, 517 | random: function (a) { 518 | for (var b = [], d = 0; d < a; d += 4) b.push(4294967296 * h.random() | 0); 519 | return new j.init(b, a) 520 | } 521 | }), 522 | m = k.enc = {}, 523 | s = m.Hex = { 524 | stringify: function (a) { 525 | var b = a.words; 526 | a = a.sigBytes; 527 | for (var d = [], c = 0; c < a; c++) { 528 | var e = b[c >>> 2] >>> 24 - 8 * (c % 4) & 255; 529 | d.push((e >>> 4).toString(16)); 530 | d.push((e & 15).toString(16)) 531 | } 532 | return d.join("") 533 | }, 534 | parse: function (a) { 535 | for (var b = a.length, d = [], c = 0; c < b; c += 2) d[c >>> 3] |= parseInt(a.substr(c, 2), 16) << 24 - 4 * (c % 8); 536 | return new j.init(d, b / 2) 537 | } 538 | }, 539 | p = m.Latin1 = { 540 | stringify: function (a) { 541 | var b = a.words; 542 | a = a.sigBytes; 543 | for (var d = [], c = 0; c < a; c++) d.push(String.fromCharCode(b[c >>> 2] >>> 24 - 8 * (c % 4) & 255)); 544 | return d.join("") 545 | }, 546 | parse: function (a) { 547 | for (var b = a.length, d = [], c = 0; c < b; c++) d[c >>> 2] |= (a.charCodeAt(c) & 255) << 24 - 8 * (c % 4); 548 | return new j.init(d, b) 549 | } 550 | }, 551 | t = m.Utf8 = { 552 | stringify: function (a) { 553 | try { 554 | return decodeURIComponent(escape(p.stringify(a))) 555 | } catch (b) { 556 | throw Error("Malformed UTF-8 data") 557 | } 558 | }, 559 | parse: function (a) { 560 | return p.parse(unescape(encodeURIComponent(a))) 561 | } 562 | }, 563 | q = l.BufferedBlockAlgorithm = f.extend({ 564 | reset: function () { 565 | this._3 = new j.init; 566 | this._19 = 0 567 | }, 568 | _11: function (a) { 569 | "string" == typeof a && (a = t.parse(a)); 570 | this._3.concat(a); 571 | this._19 += a.sigBytes 572 | }, 573 | _4: function (a) { 574 | var b = this._3, 575 | d = b.words, 576 | c = b.sigBytes, 577 | e = this.blockSize, 578 | f = c / (4 * e), 579 | f = a ? h.ceil(f) : h.max((f | 0) - this._20, 0); 580 | a = f * e; 581 | c = h.min(4 * a, c); 582 | if (a) { 583 | for (var g = 0; g < a; g += e) this._23(d, g); 584 | g = d.splice(0, a); 585 | b.sigBytes -= c 586 | } 587 | return new j.init(g, c) 588 | }, 589 | clone: function () { 590 | var a = f.clone.call(this); 591 | a._3 = this._3.clone(); 592 | return a 593 | }, 594 | _20: 0 595 | }); 596 | l.Hasher = q.extend({ 597 | cfg: f.extend(), 598 | init: function (a) { 599 | this.cfg = this.cfg.extend(a); 600 | this.reset() 601 | }, 602 | reset: function () { 603 | q.reset.call(this); 604 | this._7() 605 | }, 606 | update: function (a) { 607 | this._11(a); 608 | this._4(); 609 | return this 610 | }, 611 | finalize: function (a) { 612 | a && this._11(a); 613 | return this._10() 614 | }, 615 | blockSize: 16, 616 | _5: function (a) { 617 | return function (b, d) { 618 | return (new a.init(d)).finalize(b) 619 | } 620 | }, 621 | _30: function (a) { 622 | return function (b, d) { 623 | return (new u.HMAC.init(a, d)).finalize(b) 624 | } 625 | } 626 | }); 627 | var u = k.algo = {}; 628 | return k 629 | }(Math); 630 | (function () { 631 | var h = CryptoJS, 632 | j = h.lib.WordArray; 633 | h.enc.Base64 = { 634 | stringify: function (b) { 635 | var e = b.words, 636 | f = b.sigBytes, 637 | c = this._17; 638 | b.clamp(); 639 | b = []; 640 | for (var a = 0; a < f; a += 3) for (var d = (e[a >>> 2] >>> 24 - 8 * (a % 4) & 255) << 16 | (e[a + 1 >>> 2] >>> 24 - 8 * ((a + 1) % 4) & 255) << 8 | e[a + 2 >>> 2] >>> 24 - 8 * ((a + 2) % 4) & 255, g = 0; 4 > g && a + 0.75 * g < f; g++) b.push(c.charAt(d >>> 6 * (3 - g) & 63)); 641 | if (e = c.charAt(64)) for (; b.length % 4;) b.push(e); 642 | return b.join("") 643 | }, 644 | parse: function (b) { 645 | var e = b.length, 646 | f = this._17, 647 | c = f.charAt(64); 648 | c && (c = b.indexOf(c), -1 != c && (e = c)); 649 | for (var c = [], a = 0, d = 0; d < e; d++) if (d % 4) { 650 | var g = f.indexOf(b.charAt(d - 1)) << 2 * (d % 4), 651 | h = f.indexOf(b.charAt(d)) >>> 6 - 2 * (d % 4); 652 | c[a >>> 2] |= (g | h) << 24 - 8 * (a % 4); 653 | a++ 654 | } 655 | return j.create(c, a) 656 | }, 657 | _17: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" 658 | } 659 | })(); 660 | CryptoJS.lib.Cipher || 661 | function (u) { 662 | var g = CryptoJS, 663 | f = g.lib, 664 | k = f.Base, 665 | l = f.WordArray, 666 | q = f.BufferedBlockAlgorithm, 667 | r = g.enc.Base64, 668 | v = g.algo.EvpKDF, 669 | n = f.Cipher = q.extend({ 670 | cfg: k.extend(), 671 | createEncryptor: function (a, b) { 672 | return this.create(this._12, a, b) 673 | }, 674 | createDecryptor: function (a, b) { 675 | return this.create(this._33, a, b) 676 | }, 677 | init: function (a, b, c) { 678 | this.cfg = this.cfg.extend(c); 679 | this._16 = a; 680 | this._13 = b; 681 | this.reset() 682 | }, 683 | reset: function () { 684 | q.reset.call(this); 685 | this._7() 686 | }, 687 | process: function (a) { 688 | this._11(a); 689 | return this._4() 690 | }, 691 | finalize: function (a) { 692 | a && this._11(a); 693 | return this._10() 694 | }, 695 | keySize: 4, 696 | ivSize: 4, 697 | _12: 1, 698 | _33: 2, 699 | _5: function (a) { 700 | return { 701 | encrypt: function (b, c, d) { 702 | return ("string" == typeof c ? s : j).encrypt(a, b, c, d) 703 | }, 704 | decrypt: function (b, c, d) { 705 | return ("string" == typeof c ? s : j).decrypt(a, b, c, d) 706 | } 707 | } 708 | } 709 | }); 710 | f.StreamCipher = n.extend({ 711 | _10: function () { 712 | return this._4(!0) 713 | }, 714 | blockSize: 1 715 | }); 716 | var m = g.mode = {}, 717 | t = function (a, b, c) { 718 | var d = this._18; 719 | d ? this._18 = u : d = this._14; 720 | for (var e = 0; e < c; e++) a[b + e] ^= d[e] 721 | }, 722 | h = (f.BlockCipherMode = k.extend({ 723 | createEncryptor: function (a, b) { 724 | return this.Encryptor.create(a, b) 725 | }, 726 | createDecryptor: function (a, b) { 727 | return this.Decryptor.create(a, b) 728 | }, 729 | init: function (a, b) { 730 | this._8 = a; 731 | this._18 = b 732 | } 733 | })).extend(); 734 | h.Encryptor = h.extend({ 735 | processBlock: function (a, b) { 736 | var c = this._8, 737 | d = c.blockSize; 738 | t.call(this, a, b, d); 739 | c.encryptBlock(a, b); 740 | this._14 = a.slice(b, b + d) 741 | } 742 | }); 743 | h.Decryptor = h.extend({ 744 | processBlock: function (a, b) { 745 | var c = this._8, 746 | d = c.blockSize, 747 | e = a.slice(b, b + d); 748 | c.decryptBlock(a, b); 749 | t.call(this, a, b, d); 750 | this._14 = e 751 | } 752 | }); 753 | m = m.CBC = h; 754 | h = (g.pad = {}).Pkcs7 = { 755 | pad: function (a, b) { 756 | for (var c = 4 * b, c = c - a.sigBytes % c, d = c << 24 | c << 16 | c << 8 | c, e = [], f = 0; f < c; f += 4) e.push(d); 757 | c = l.create(e, c); 758 | a.concat(c) 759 | }, 760 | unpad: function (a) { 761 | a.sigBytes -= a.words[a.sigBytes - 1 >>> 2] & 255 762 | } 763 | }; 764 | f.BlockCipher = n.extend({ 765 | cfg: n.cfg.extend({ 766 | mode: m, 767 | padding: h 768 | }), 769 | reset: function () { 770 | n.reset.call(this); 771 | var a = this.cfg, 772 | b = a.iv, 773 | a = a.mode; 774 | if (this._16 == this._12) var c = a.createEncryptor; 775 | else c = a.createDecryptor, 776 | this._20 = 1; 777 | this._31 = c.call(a, this, b && b.words) 778 | }, 779 | _23: function (a, b) { 780 | this._31.processBlock(a, b) 781 | }, 782 | _10: function () { 783 | var a = this.cfg.padding; 784 | if (this._16 == this._12) { 785 | a.pad(this._3, this.blockSize); 786 | var b = this._4(!0) 787 | } else b = this._4(!0), 788 | a.unpad(b); 789 | return b 790 | }, 791 | blockSize: 4 792 | }); 793 | var p = f.CipherParams = k.extend({ 794 | init: function (a) { 795 | this.mixIn(a) 796 | }, 797 | toString: function (a) { 798 | return (a || this.formatter).stringify(this) 799 | } 800 | }), 801 | m = (g.format = {}).OpenSSL = { 802 | stringify: function (a) { 803 | var b = a.ciphertext; 804 | a = a.salt; 805 | return (a ? l.create([1398893684, 1701076831]).concat(a).concat(b) : b).toString(r) 806 | }, 807 | parse: function (a) { 808 | a = r.parse(a); 809 | var b = a.words; 810 | if (1398893684 == b[0] && 1701076831 == b[1]) { 811 | var c = l.create(b.slice(2, 4)); 812 | b.splice(0, 4); 813 | a.sigBytes -= 16 814 | } 815 | return p.create({ 816 | ciphertext: a, 817 | salt: c 818 | }) 819 | } 820 | }, 821 | j = f.SerializableCipher = k.extend({ 822 | cfg: k.extend({ 823 | format: m 824 | }), 825 | encrypt: function (a, b, c, d) { 826 | d = this.cfg.extend(d); 827 | var e = a.createEncryptor(c, d); 828 | b = e.finalize(b); 829 | e = e.cfg; 830 | return p.create({ 831 | ciphertext: b, 832 | key: c, 833 | iv: e.iv, 834 | algorithm: a, 835 | mode: e.mode, 836 | padding: e.padding, 837 | blockSize: a.blockSize, 838 | formatter: d.format 839 | }) 840 | }, 841 | decrypt: function (a, b, c, d) { 842 | d = this.cfg.extend(d); 843 | b = this._15(b, d.format); 844 | return a.createDecryptor(c, d).finalize(b.ciphertext) 845 | }, 846 | _15: function (a, b) { 847 | return "string" == typeof a ? b.parse(a, this) : a 848 | } 849 | }), 850 | g = (g.kdf = {}).OpenSSL = { 851 | execute: function (a, b, c, d) { 852 | d || (d = l.random(8)); 853 | a = v.create({ 854 | keySize: b + c 855 | }).compute(a, d); 856 | c = l.create(a.words.slice(b), 4 * c); 857 | a.sigBytes = 4 * b; 858 | return p.create({ 859 | key: a, 860 | iv: c, 861 | salt: d 862 | }) 863 | } 864 | }, 865 | s = f.PasswordBasedCipher = j.extend({ 866 | cfg: j.cfg.extend({ 867 | kdf: g 868 | }), 869 | encrypt: function (a, b, c, d) { 870 | d = this.cfg.extend(d); 871 | c = d.kdf.execute(c, a.keySize, a.ivSize); 872 | d.iv = c.iv; 873 | a = j.encrypt.call(this, a, b, c.key, d); 874 | a.mixIn(c); 875 | return a 876 | }, 877 | decrypt: function (a, b, c, d) { 878 | d = this.cfg.extend(d); 879 | b = this._15(b, d.format); 880 | c = d.kdf.execute(c, a.keySize, a.ivSize, b.salt); 881 | d.iv = c.iv; 882 | return j.decrypt.call(this, a, b, c.key, d) 883 | } 884 | }) 885 | }(); 886 | CryptoJS.mode.ECB = function () { 887 | var a = CryptoJS.lib.BlockCipherMode.extend(); 888 | a.Encryptor = a.extend({ 889 | processBlock: function (a, b) { 890 | this._8.encryptBlock(a, b) 891 | } 892 | }); 893 | a.Decryptor = a.extend({ 894 | processBlock: function (a, b) { 895 | this._8.decryptBlock(a, b) 896 | } 897 | }); 898 | return a 899 | }(); 900 | (function (E) { 901 | function h(a, f, g, j, p, h, k) { 902 | a = a + (f & g | ~f & j) + p + k; 903 | return (a << h | a >>> 32 - h) + f 904 | } 905 | function k(a, f, g, j, p, h, k) { 906 | a = a + (f & j | g & ~j) + p + k; 907 | return (a << h | a >>> 32 - h) + f 908 | } 909 | function l(a, f, g, j, h, k, l) { 910 | a = a + (f ^ g ^ j) + h + l; 911 | return (a << k | a >>> 32 - k) + f 912 | } 913 | function n(a, f, g, j, h, k, l) { 914 | a = a + (g ^ (f | ~j)) + h + l; 915 | return (a << k | a >>> 32 - k) + f 916 | } 917 | for (var r = CryptoJS, q = r.lib, F = q.WordArray, s = q.Hasher, q = r.algo, a = [], t = 0; 64 > t; t++) a[t] = 4294967296 * E.abs(E.sin(t + 1)) | 0; 918 | q = q.MD5 = s.extend({ 919 | _7: function () { 920 | this._9 = new F.init([1732584193, 4023233417, 2562383102, 271733878]) 921 | }, 922 | _23: function (m, f) { 923 | for (var g = 0; 16 > g; g++) { 924 | var j = f + g, 925 | p = m[j]; 926 | m[j] = (p << 8 | p >>> 24) & 16711935 | (p << 24 | p >>> 8) & 4278255360 927 | } 928 | var g = this._9.words, 929 | j = m[f + 0], 930 | p = m[f + 1], 931 | q = m[f + 2], 932 | r = m[f + 3], 933 | s = m[f + 4], 934 | t = m[f + 5], 935 | u = m[f + 6], 936 | v = m[f + 7], 937 | w = m[f + 8], 938 | x = m[f + 9], 939 | y = m[f + 10], 940 | z = m[f + 11], 941 | A = m[f + 12], 942 | B = m[f + 13], 943 | C = m[f + 14], 944 | D = m[f + 15], 945 | b = g[0], 946 | c = g[1], 947 | d = g[2], 948 | e = g[3], 949 | b = h(b, c, d, e, j, 7, a[0]), 950 | e = h(e, b, c, d, p, 12, a[1]), 951 | d = h(d, e, b, c, q, 17, a[2]), 952 | c = h(c, d, e, b, r, 22, a[3]), 953 | b = h(b, c, d, e, s, 7, a[4]), 954 | e = h(e, b, c, d, t, 12, a[5]), 955 | d = h(d, e, b, c, u, 17, a[6]), 956 | c = h(c, d, e, b, v, 22, a[7]), 957 | b = h(b, c, d, e, w, 7, a[8]), 958 | e = h(e, b, c, d, x, 12, a[9]), 959 | d = h(d, e, b, c, y, 17, a[10]), 960 | c = h(c, d, e, b, z, 22, a[11]), 961 | b = h(b, c, d, e, A, 7, a[12]), 962 | e = h(e, b, c, d, B, 12, a[13]), 963 | d = h(d, e, b, c, C, 17, a[14]), 964 | c = h(c, d, e, b, D, 22, a[15]), 965 | b = k(b, c, d, e, p, 5, a[16]), 966 | e = k(e, b, c, d, u, 9, a[17]), 967 | d = k(d, e, b, c, z, 14, a[18]), 968 | c = k(c, d, e, b, j, 20, a[19]), 969 | b = k(b, c, d, e, t, 5, a[20]), 970 | e = k(e, b, c, d, y, 9, a[21]), 971 | d = k(d, e, b, c, D, 14, a[22]), 972 | c = k(c, d, e, b, s, 20, a[23]), 973 | b = k(b, c, d, e, x, 5, a[24]), 974 | e = k(e, b, c, d, C, 9, a[25]), 975 | d = k(d, e, b, c, r, 14, a[26]), 976 | c = k(c, d, e, b, w, 20, a[27]), 977 | b = k(b, c, d, e, B, 5, a[28]), 978 | e = k(e, b, c, d, q, 9, a[29]), 979 | d = k(d, e, b, c, v, 14, a[30]), 980 | c = k(c, d, e, b, A, 20, a[31]), 981 | b = l(b, c, d, e, t, 4, a[32]), 982 | e = l(e, b, c, d, w, 11, a[33]), 983 | d = l(d, e, b, c, z, 16, a[34]), 984 | c = l(c, d, e, b, C, 23, a[35]), 985 | b = l(b, c, d, e, p, 4, a[36]), 986 | e = l(e, b, c, d, s, 11, a[37]), 987 | d = l(d, e, b, c, v, 16, a[38]), 988 | c = l(c, d, e, b, y, 23, a[39]), 989 | b = l(b, c, d, e, B, 4, a[40]), 990 | e = l(e, b, c, d, j, 11, a[41]), 991 | d = l(d, e, b, c, r, 16, a[42]), 992 | c = l(c, d, e, b, u, 23, a[43]), 993 | b = l(b, c, d, e, x, 4, a[44]), 994 | e = l(e, b, c, d, A, 11, a[45]), 995 | d = l(d, e, b, c, D, 16, a[46]), 996 | c = l(c, d, e, b, q, 23, a[47]), 997 | b = n(b, c, d, e, j, 6, a[48]), 998 | e = n(e, b, c, d, v, 10, a[49]), 999 | d = n(d, e, b, c, C, 15, a[50]), 1000 | c = n(c, d, e, b, t, 21, a[51]), 1001 | b = n(b, c, d, e, A, 6, a[52]), 1002 | e = n(e, b, c, d, r, 10, a[53]), 1003 | d = n(d, e, b, c, y, 15, a[54]), 1004 | c = n(c, d, e, b, p, 21, a[55]), 1005 | b = n(b, c, d, e, w, 6, a[56]), 1006 | e = n(e, b, c, d, D, 10, a[57]), 1007 | d = n(d, e, b, c, u, 15, a[58]), 1008 | c = n(c, d, e, b, B, 21, a[59]), 1009 | b = n(b, c, d, e, s, 6, a[60]), 1010 | e = n(e, b, c, d, z, 10, a[61]), 1011 | d = n(d, e, b, c, q, 15, a[62]), 1012 | c = n(c, d, e, b, x, 21, a[63]); 1013 | g[0] = g[0] + b | 0; 1014 | g[1] = g[1] + c | 0; 1015 | g[2] = g[2] + d | 0; 1016 | g[3] = g[3] + e | 0 1017 | }, 1018 | _10: function () { 1019 | var a = this._3, 1020 | f = a.words, 1021 | g = 8 * this._19, 1022 | j = 8 * a.sigBytes; 1023 | f[j >>> 5] |= 128 << 24 - j % 32; 1024 | var h = E.floor(g / 4294967296); 1025 | f[(j + 64 >>> 9 << 4) + 15] = (h << 8 | h >>> 24) & 16711935 | (h << 24 | h >>> 8) & 4278255360; 1026 | f[(j + 64 >>> 9 << 4) + 14] = (g << 8 | g >>> 24) & 16711935 | (g << 24 | g >>> 8) & 4278255360; 1027 | a.sigBytes = 4 * (f.length + 1); 1028 | this._4(); 1029 | a = this._9; 1030 | f = a.words; 1031 | for (g = 0; 4 > g; g++) j = f[g], 1032 | f[g] = (j << 8 | j >>> 24) & 16711935 | (j << 24 | j >>> 8) & 4278255360; 1033 | return a 1034 | }, 1035 | clone: function () { 1036 | var a = s.clone.call(this); 1037 | a._9 = this._9.clone(); 1038 | return a 1039 | } 1040 | }); 1041 | r.MD5 = s._5(q); 1042 | r.HmacMD5 = s._30(q) 1043 | })(Math); 1044 | (function () { 1045 | for (var q = CryptoJS, x = q.lib.BlockCipher, r = q.algo, j = [], y = [], z = [], A = [], B = [], C = [], s = [], u = [], v = [], w = [], g = [], k = 0; 256 > k; k++) g[k] = 128 > k ? k << 1 : k << 1 ^ 283; 1046 | for (var n = 0, l = 0, k = 0; 256 > k; k++) { 1047 | var f = l ^ l << 1 ^ l << 2 ^ l << 3 ^ l << 4, 1048 | f = f >>> 8 ^ f & 255 ^ 99; 1049 | j[n] = f; 1050 | y[f] = n; 1051 | var t = g[n], 1052 | D = g[t], 1053 | E = g[D], 1054 | b = 257 * g[f] ^ 16843008 * f; 1055 | z[n] = b << 24 | b >>> 8; 1056 | A[n] = b << 16 | b >>> 16; 1057 | B[n] = b << 8 | b >>> 24; 1058 | C[n] = b; 1059 | b = 16843009 * E ^ 65537 * D ^ 257 * t ^ 16843008 * n; 1060 | s[f] = b << 24 | b >>> 8; 1061 | u[f] = b << 16 | b >>> 16; 1062 | v[f] = b << 8 | b >>> 24; 1063 | w[f] = b; 1064 | n ? (n = t ^ g[g[g[E ^ t]]], l ^= g[g[l]]) : n = l = 1 1065 | } 1066 | var F = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], 1067 | r = r.AES = x.extend({ 1068 | _7: function () { 1069 | for (var c = this._13, e = c.words, a = c.sigBytes / 4, c = 4 * ((this._26 = a + 6) + 1), b = this._32 = [], h = 0; h < c; h++) if (h < a) b[h] = e[h]; 1070 | else { 1071 | var d = b[h - 1]; 1072 | h % a ? 6 < a && 4 == h % a && (d = j[d >>> 24] << 24 | j[d >>> 16 & 255] << 16 | j[d >>> 8 & 255] << 8 | j[d & 255]) : (d = d << 8 | d >>> 24, d = j[d >>> 24] << 24 | j[d >>> 16 & 255] << 16 | j[d >>> 8 & 255] << 8 | j[d & 255], d ^= F[h / a | 0] << 24); 1073 | b[h] = b[h - a] ^ d 1074 | } 1075 | e = this._34 = []; 1076 | for (a = 0; a < c; a++) h = c - a, 1077 | d = a % 4 ? b[h] : b[h - 4], 1078 | e[a] = 4 > a || 4 >= h ? d : s[j[d >>> 24]] ^ u[j[d >>> 16 & 255]] ^ v[j[d >>> 8 & 255]] ^ w[j[d & 255]] 1079 | }, 1080 | encryptBlock: function (c, e) { 1081 | this._6(c, e, this._32, z, A, B, C, j) 1082 | }, 1083 | decryptBlock: function (c, e) { 1084 | var a = c[e + 1]; 1085 | c[e + 1] = c[e + 3]; 1086 | c[e + 3] = a; 1087 | this._6(c, e, this._34, s, u, v, w, y); 1088 | a = c[e + 1]; 1089 | c[e + 1] = c[e + 3]; 1090 | c[e + 3] = a 1091 | }, 1092 | _6: function (c, e, a, b, h, d, j, m) { 1093 | for (var n = this._26, f = c[e] ^ a[0], g = c[e + 1] ^ a[1], k = c[e + 2] ^ a[2], p = c[e + 3] ^ a[3], l = 4, t = 1; t < n; t++) var q = b[f >>> 24] ^ h[g >>> 16 & 255] ^ d[k >>> 8 & 255] ^ j[p & 255] ^ a[l++], 1094 | r = b[g >>> 24] ^ h[k >>> 16 & 255] ^ d[p >>> 8 & 255] ^ j[f & 255] ^ a[l++], 1095 | s = b[k >>> 24] ^ h[p >>> 16 & 255] ^ d[f >>> 8 & 255] ^ j[g & 255] ^ a[l++], 1096 | p = b[p >>> 24] ^ h[f >>> 16 & 255] ^ d[g >>> 8 & 255] ^ j[k & 255] ^ a[l++], 1097 | f = q, 1098 | g = r, 1099 | k = s; 1100 | q = (m[f >>> 24] << 24 | m[g >>> 16 & 255] << 16 | m[k >>> 8 & 255] << 8 | m[p & 255]) ^ a[l++]; 1101 | r = (m[g >>> 24] << 24 | m[k >>> 16 & 255] << 16 | m[p >>> 8 & 255] << 8 | m[f & 255]) ^ a[l++]; 1102 | s = (m[k >>> 24] << 24 | m[p >>> 16 & 255] << 16 | m[f >>> 8 & 255] << 8 | m[g & 255]) ^ a[l++]; 1103 | p = (m[p >>> 24] << 24 | m[f >>> 16 & 255] << 16 | m[g >>> 8 & 255] << 8 | m[k & 255]) ^ a[l++]; 1104 | c[e] = q; 1105 | c[e + 1] = r; 1106 | c[e + 2] = s; 1107 | c[e + 3] = p 1108 | }, 1109 | keySize: 8 1110 | }); 1111 | q.AES = x._5(r) 1112 | })(); 1113 | (function () { 1114 | function j(b, c) { 1115 | var a = (this._0 >>> b ^ this._1) & c; 1116 | this._1 ^= a; 1117 | this._0 ^= a << b 1118 | } 1119 | function l(b, c) { 1120 | var a = (this._1 >>> b ^ this._0) & c; 1121 | this._0 ^= a; 1122 | this._1 ^= a << b 1123 | } 1124 | var h = CryptoJS, 1125 | e = h.lib, 1126 | n = e.WordArray, 1127 | e = e.BlockCipher, 1128 | g = h.algo, 1129 | q = [57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4], 1130 | p = [14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32], 1131 | r = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28], 1132 | s = [{ 1133 | "0": 8421888, 1134 | 268435456: 32768, 1135 | 536870912: 8421378, 1136 | 805306368: 2, 1137 | 1073741824: 512, 1138 | 1342177280: 8421890, 1139 | 1610612736: 8389122, 1140 | 1879048192: 8388608, 1141 | 2147483648: 514, 1142 | 2415919104: 8389120, 1143 | 2684354560: 33280, 1144 | 2952790016: 8421376, 1145 | 3221225472: 32770, 1146 | 3489660928: 8388610, 1147 | 3758096384: 0, 1148 | 4026531840: 33282, 1149 | 134217728: 0, 1150 | 402653184: 8421890, 1151 | 671088640: 33282, 1152 | 939524096: 32768, 1153 | 1207959552: 8421888, 1154 | 1476395008: 512, 1155 | 1744830464: 8421378, 1156 | 2013265920: 2, 1157 | 2281701376: 8389120, 1158 | 2550136832: 33280, 1159 | 2818572288: 8421376, 1160 | 3087007744: 8389122, 1161 | 3355443200: 8388610, 1162 | 3623878656: 32770, 1163 | 3892314112: 514, 1164 | 4160749568: 8388608, 1165 | 1: 32768, 1166 | 268435457: 2, 1167 | 536870913: 8421888, 1168 | 805306369: 8388608, 1169 | 1073741825: 8421378, 1170 | 1342177281: 33280, 1171 | 1610612737: 512, 1172 | 1879048193: 8389122, 1173 | 2147483649: 8421890, 1174 | 2415919105: 8421376, 1175 | 2684354561: 8388610, 1176 | 2952790017: 33282, 1177 | 3221225473: 514, 1178 | 3489660929: 8389120, 1179 | 3758096385: 32770, 1180 | 4026531841: 0, 1181 | 134217729: 8421890, 1182 | 402653185: 8421376, 1183 | 671088641: 8388608, 1184 | 939524097: 512, 1185 | 1207959553: 32768, 1186 | 1476395009: 8388610, 1187 | 1744830465: 2, 1188 | 2013265921: 33282, 1189 | 2281701377: 32770, 1190 | 2550136833: 8389122, 1191 | 2818572289: 514, 1192 | 3087007745: 8421888, 1193 | 3355443201: 8389120, 1194 | 3623878657: 0, 1195 | 3892314113: 33280, 1196 | 4160749569: 8421378 1197 | }, 1198 | { 1199 | "0": 1074282512, 1200 | 16777216: 16384, 1201 | 33554432: 524288, 1202 | 50331648: 1074266128, 1203 | 67108864: 1073741840, 1204 | 83886080: 1074282496, 1205 | 100663296: 1073758208, 1206 | 117440512: 16, 1207 | 134217728: 540672, 1208 | 150994944: 1073758224, 1209 | 167772160: 1073741824, 1210 | 184549376: 540688, 1211 | 201326592: 524304, 1212 | 218103808: 0, 1213 | 234881024: 16400, 1214 | 251658240: 1074266112, 1215 | 8388608: 1073758208, 1216 | 25165824: 540688, 1217 | 41943040: 16, 1218 | 58720256: 1073758224, 1219 | 75497472: 1074282512, 1220 | 92274688: 1073741824, 1221 | 109051904: 524288, 1222 | 125829120: 1074266128, 1223 | 142606336: 524304, 1224 | 159383552: 0, 1225 | 176160768: 16384, 1226 | 192937984: 1074266112, 1227 | 209715200: 1073741840, 1228 | 226492416: 540672, 1229 | 243269632: 1074282496, 1230 | 260046848: 16400, 1231 | 268435456: 0, 1232 | 285212672: 1074266128, 1233 | 301989888: 1073758224, 1234 | 318767104: 1074282496, 1235 | 335544320: 1074266112, 1236 | 352321536: 16, 1237 | 369098752: 540688, 1238 | 385875968: 16384, 1239 | 402653184: 16400, 1240 | 419430400: 524288, 1241 | 436207616: 524304, 1242 | 452984832: 1073741840, 1243 | 469762048: 540672, 1244 | 486539264: 1073758208, 1245 | 503316480: 1073741824, 1246 | 520093696: 1074282512, 1247 | 276824064: 540688, 1248 | 293601280: 524288, 1249 | 310378496: 1074266112, 1250 | 327155712: 16384, 1251 | 343932928: 1073758208, 1252 | 360710144: 1074282512, 1253 | 377487360: 16, 1254 | 394264576: 1073741824, 1255 | 411041792: 1074282496, 1256 | 427819008: 1073741840, 1257 | 444596224: 1073758224, 1258 | 461373440: 524304, 1259 | 478150656: 0, 1260 | 494927872: 16400, 1261 | 511705088: 1074266128, 1262 | 528482304: 540672 1263 | }, 1264 | { 1265 | "0": 260, 1266 | 1048576: 0, 1267 | 2097152: 67109120, 1268 | 3145728: 65796, 1269 | 4194304: 65540, 1270 | 5242880: 67108868, 1271 | 6291456: 67174660, 1272 | 7340032: 67174400, 1273 | 8388608: 67108864, 1274 | 9437184: 67174656, 1275 | 10485760: 65792, 1276 | 11534336: 67174404, 1277 | 12582912: 67109124, 1278 | 13631488: 65536, 1279 | 14680064: 4, 1280 | 15728640: 256, 1281 | 524288: 67174656, 1282 | 1572864: 67174404, 1283 | 2621440: 0, 1284 | 3670016: 67109120, 1285 | 4718592: 67108868, 1286 | 5767168: 65536, 1287 | 6815744: 65540, 1288 | 7864320: 260, 1289 | 8912896: 4, 1290 | 9961472: 256, 1291 | 11010048: 67174400, 1292 | 12058624: 65796, 1293 | 13107200: 65792, 1294 | 14155776: 67109124, 1295 | 15204352: 67174660, 1296 | 16252928: 67108864, 1297 | 16777216: 67174656, 1298 | 17825792: 65540, 1299 | 18874368: 65536, 1300 | 19922944: 67109120, 1301 | 20971520: 256, 1302 | 22020096: 67174660, 1303 | 23068672: 67108868, 1304 | 24117248: 0, 1305 | 25165824: 67109124, 1306 | 26214400: 67108864, 1307 | 27262976: 4, 1308 | 28311552: 65792, 1309 | 29360128: 67174400, 1310 | 30408704: 260, 1311 | 31457280: 65796, 1312 | 32505856: 67174404, 1313 | 17301504: 67108864, 1314 | 18350080: 260, 1315 | 19398656: 67174656, 1316 | 20447232: 0, 1317 | 21495808: 65540, 1318 | 22544384: 67109120, 1319 | 23592960: 256, 1320 | 24641536: 67174404, 1321 | 25690112: 65536, 1322 | 26738688: 67174660, 1323 | 27787264: 65796, 1324 | 28835840: 67108868, 1325 | 29884416: 67109124, 1326 | 30932992: 67174400, 1327 | 31981568: 4, 1328 | 33030144: 65792 1329 | }, 1330 | { 1331 | "0": 2151682048, 1332 | 65536: 2147487808, 1333 | 131072: 4198464, 1334 | 196608: 2151677952, 1335 | 262144: 0, 1336 | 327680: 4198400, 1337 | 393216: 2147483712, 1338 | 458752: 4194368, 1339 | 524288: 2147483648, 1340 | 589824: 4194304, 1341 | 655360: 64, 1342 | 720896: 2147487744, 1343 | 786432: 2151678016, 1344 | 851968: 4160, 1345 | 917504: 4096, 1346 | 983040: 2151682112, 1347 | 32768: 2147487808, 1348 | 98304: 64, 1349 | 163840: 2151678016, 1350 | 229376: 2147487744, 1351 | 294912: 4198400, 1352 | 360448: 2151682112, 1353 | 425984: 0, 1354 | 491520: 2151677952, 1355 | 557056: 4096, 1356 | 622592: 2151682048, 1357 | 688128: 4194304, 1358 | 753664: 4160, 1359 | 819200: 2147483648, 1360 | 884736: 4194368, 1361 | 950272: 4198464, 1362 | 1015808: 2147483712, 1363 | 1048576: 4194368, 1364 | 1114112: 4198400, 1365 | 1179648: 2147483712, 1366 | 1245184: 0, 1367 | 1310720: 4160, 1368 | 1376256: 2151678016, 1369 | 1441792: 2151682048, 1370 | 1507328: 2147487808, 1371 | 1572864: 2151682112, 1372 | 1638400: 2147483648, 1373 | 1703936: 2151677952, 1374 | 1769472: 4198464, 1375 | 1835008: 2147487744, 1376 | 1900544: 4194304, 1377 | 1966080: 64, 1378 | 2031616: 4096, 1379 | 1081344: 2151677952, 1380 | 1146880: 2151682112, 1381 | 1212416: 0, 1382 | 1277952: 4198400, 1383 | 1343488: 4194368, 1384 | 1409024: 2147483648, 1385 | 1474560: 2147487808, 1386 | 1540096: 64, 1387 | 1605632: 2147483712, 1388 | 1671168: 4096, 1389 | 1736704: 2147487744, 1390 | 1802240: 2151678016, 1391 | 1867776: 4160, 1392 | 1933312: 2151682048, 1393 | 1998848: 4194304, 1394 | 2064384: 4198464 1395 | }, 1396 | { 1397 | "0": 128, 1398 | 4096: 17039360, 1399 | 8192: 262144, 1400 | 12288: 536870912, 1401 | 16384: 537133184, 1402 | 20480: 16777344, 1403 | 24576: 553648256, 1404 | 28672: 262272, 1405 | 32768: 16777216, 1406 | 36864: 537133056, 1407 | 40960: 536871040, 1408 | 45056: 553910400, 1409 | 49152: 553910272, 1410 | 53248: 0, 1411 | 57344: 17039488, 1412 | 61440: 553648128, 1413 | 2048: 17039488, 1414 | 6144: 553648256, 1415 | 10240: 128, 1416 | 14336: 17039360, 1417 | 18432: 262144, 1418 | 22528: 537133184, 1419 | 26624: 553910272, 1420 | 30720: 536870912, 1421 | 34816: 537133056, 1422 | 38912: 0, 1423 | 43008: 553910400, 1424 | 47104: 16777344, 1425 | 51200: 536871040, 1426 | 55296: 553648128, 1427 | 59392: 16777216, 1428 | 63488: 262272, 1429 | 65536: 262144, 1430 | 69632: 128, 1431 | 73728: 536870912, 1432 | 77824: 553648256, 1433 | 81920: 16777344, 1434 | 86016: 553910272, 1435 | 90112: 537133184, 1436 | 94208: 16777216, 1437 | 98304: 553910400, 1438 | 102400: 553648128, 1439 | 106496: 17039360, 1440 | 110592: 537133056, 1441 | 114688: 262272, 1442 | 118784: 536871040, 1443 | 122880: 0, 1444 | 126976: 17039488, 1445 | 67584: 553648256, 1446 | 71680: 16777216, 1447 | 75776: 17039360, 1448 | 79872: 537133184, 1449 | 83968: 536870912, 1450 | 88064: 17039488, 1451 | 92160: 128, 1452 | 96256: 553910272, 1453 | 100352: 262272, 1454 | 104448: 553910400, 1455 | 108544: 0, 1456 | 112640: 553648128, 1457 | 116736: 16777344, 1458 | 120832: 262144, 1459 | 124928: 537133056, 1460 | 129024: 536871040 1461 | }, 1462 | { 1463 | "0": 268435464, 1464 | 256: 8192, 1465 | 512: 270532608, 1466 | 768: 270540808, 1467 | 1024: 268443648, 1468 | 1280: 2097152, 1469 | 1536: 2097160, 1470 | 1792: 268435456, 1471 | 2048: 0, 1472 | 2304: 268443656, 1473 | 2560: 2105344, 1474 | 2816: 8, 1475 | 3072: 270532616, 1476 | 3328: 2105352, 1477 | 3584: 8200, 1478 | 3840: 270540800, 1479 | 128: 270532608, 1480 | 384: 270540808, 1481 | 640: 8, 1482 | 896: 2097152, 1483 | 1152: 2105352, 1484 | 1408: 268435464, 1485 | 1664: 268443648, 1486 | 1920: 8200, 1487 | 2176: 2097160, 1488 | 2432: 8192, 1489 | 2688: 268443656, 1490 | 2944: 270532616, 1491 | 3200: 0, 1492 | 3456: 270540800, 1493 | 3712: 2105344, 1494 | 3968: 268435456, 1495 | 4096: 268443648, 1496 | 4352: 270532616, 1497 | 4608: 270540808, 1498 | 4864: 8200, 1499 | 5120: 2097152, 1500 | 5376: 268435456, 1501 | 5632: 268435464, 1502 | 5888: 2105344, 1503 | 6144: 2105352, 1504 | 6400: 0, 1505 | 6656: 8, 1506 | 6912: 270532608, 1507 | 7168: 8192, 1508 | 7424: 268443656, 1509 | 7680: 270540800, 1510 | 7936: 2097160, 1511 | 4224: 8, 1512 | 4480: 2105344, 1513 | 4736: 2097152, 1514 | 4992: 268435464, 1515 | 5248: 268443648, 1516 | 5504: 8200, 1517 | 5760: 270540808, 1518 | 6016: 270532608, 1519 | 6272: 270540800, 1520 | 6528: 270532616, 1521 | 6784: 8192, 1522 | 7040: 2105352, 1523 | 7296: 2097160, 1524 | 7552: 0, 1525 | 7808: 268435456, 1526 | 8064: 268443656 1527 | }, 1528 | { 1529 | "0": 1048576, 1530 | 16: 33555457, 1531 | 32: 1024, 1532 | 48: 1049601, 1533 | 64: 34604033, 1534 | 80: 0, 1535 | 96: 1, 1536 | 112: 34603009, 1537 | 128: 33555456, 1538 | 144: 1048577, 1539 | 160: 33554433, 1540 | 176: 34604032, 1541 | 192: 34603008, 1542 | 208: 1025, 1543 | 224: 1049600, 1544 | 240: 33554432, 1545 | 8: 34603009, 1546 | 24: 0, 1547 | 40: 33555457, 1548 | 56: 34604032, 1549 | 72: 1048576, 1550 | 88: 33554433, 1551 | 104: 33554432, 1552 | 120: 1025, 1553 | 136: 1049601, 1554 | 152: 33555456, 1555 | 168: 34603008, 1556 | 184: 1048577, 1557 | 200: 1024, 1558 | 216: 34604033, 1559 | 232: 1, 1560 | 248: 1049600, 1561 | 256: 33554432, 1562 | 272: 1048576, 1563 | 288: 33555457, 1564 | 304: 34603009, 1565 | 320: 1048577, 1566 | 336: 33555456, 1567 | 352: 34604032, 1568 | 368: 1049601, 1569 | 384: 1025, 1570 | 400: 34604033, 1571 | 416: 1049600, 1572 | 432: 1, 1573 | 448: 0, 1574 | 464: 34603008, 1575 | 480: 33554433, 1576 | 496: 1024, 1577 | 264: 1049600, 1578 | 280: 33555457, 1579 | 296: 34603009, 1580 | 312: 1, 1581 | 328: 33554432, 1582 | 344: 1048576, 1583 | 360: 1025, 1584 | 376: 34604032, 1585 | 392: 33554433, 1586 | 408: 34603008, 1587 | 424: 0, 1588 | 440: 34604033, 1589 | 456: 1049601, 1590 | 472: 1024, 1591 | 488: 33555456, 1592 | 504: 1048577 1593 | }, 1594 | { 1595 | "0": 134219808, 1596 | 1: 131072, 1597 | 2: 134217728, 1598 | 3: 32, 1599 | 4: 131104, 1600 | 5: 134350880, 1601 | 6: 134350848, 1602 | 7: 2048, 1603 | 8: 134348800, 1604 | 9: 134219776, 1605 | 10: 133120, 1606 | 11: 134348832, 1607 | 12: 2080, 1608 | 13: 0, 1609 | 14: 134217760, 1610 | 15: 133152, 1611 | 2147483648: 2048, 1612 | 2147483649: 134350880, 1613 | 2147483650: 134219808, 1614 | 2147483651: 134217728, 1615 | 2147483652: 134348800, 1616 | 2147483653: 133120, 1617 | 2147483654: 133152, 1618 | 2147483655: 32, 1619 | 2147483656: 134217760, 1620 | 2147483657: 2080, 1621 | 2147483658: 131104, 1622 | 2147483659: 134350848, 1623 | 2147483660: 0, 1624 | 2147483661: 134348832, 1625 | 2147483662: 134219776, 1626 | 2147483663: 131072, 1627 | 16: 133152, 1628 | 17: 134350848, 1629 | 18: 32, 1630 | 19: 2048, 1631 | 20: 134219776, 1632 | 21: 134217760, 1633 | 22: 134348832, 1634 | 23: 131072, 1635 | 24: 0, 1636 | 25: 131104, 1637 | 26: 134348800, 1638 | 27: 134219808, 1639 | 28: 134350880, 1640 | 29: 133120, 1641 | 30: 2080, 1642 | 31: 134217728, 1643 | 2147483664: 131072, 1644 | 2147483665: 2048, 1645 | 2147483666: 134348832, 1646 | 2147483667: 133152, 1647 | 2147483668: 32, 1648 | 2147483669: 134348800, 1649 | 2147483670: 134217728, 1650 | 2147483671: 134219808, 1651 | 2147483672: 134350880, 1652 | 2147483673: 134217760, 1653 | 2147483674: 134219776, 1654 | 2147483675: 0, 1655 | 2147483676: 133120, 1656 | 2147483677: 2080, 1657 | 2147483678: 131104, 1658 | 2147483679: 134350848 1659 | }], 1660 | t = [4160749569, 528482304, 33030144, 2064384, 129024, 8064, 504, 2147483679], 1661 | m = g.DES = e.extend({ 1662 | _7: function () { 1663 | for (var b = this._13.words, c = [], a = 0; 56 > a; a++) { 1664 | var f = q[a] - 1; 1665 | c[a] = b[f >>> 5] >>> 31 - f % 32 & 1 1666 | } 1667 | b = this._25 = []; 1668 | for (f = 0; 16 > f; f++) { 1669 | for (var d = b[f] = [], e = r[f], a = 0; 24 > a; a++) d[a / 6 | 0] |= c[(p[a] - 1 + e) % 28] << 31 - a % 6, 1670 | d[4 + (a / 6 | 0)] |= c[28 + (p[a + 24] - 1 + e) % 28] << 31 - a % 6; 1671 | d[0] = d[0] << 1 | d[0] >>> 31; 1672 | for (a = 1; 7 > a; a++) d[a] >>>= 4 * (a - 1) + 3; 1673 | d[7] = d[7] << 5 | d[7] >>> 27 1674 | } 1675 | c = this._28 = []; 1676 | for (a = 0; 16 > a; a++) c[a] = b[15 - a] 1677 | }, 1678 | encryptBlock: function (b, c) { 1679 | this._6(b, c, this._25) 1680 | }, 1681 | decryptBlock: function (b, c) { 1682 | this._6(b, c, this._28) 1683 | }, 1684 | _6: function (b, c, a) { 1685 | this._0 = b[c]; 1686 | this._1 = b[c + 1]; 1687 | j.call(this, 4, 252645135); 1688 | j.call(this, 16, 65535); 1689 | l.call(this, 2, 858993459); 1690 | l.call(this, 8, 16711935); 1691 | j.call(this, 1, 1431655765); 1692 | for (var f = 0; 16 > f; f++) { 1693 | for (var d = a[f], e = this._0, h = this._1, g = 0, k = 0; 8 > k; k++) g |= s[k][((h ^ d[k]) & t[k]) >>> 0]; 1694 | this._0 = h; 1695 | this._1 = e ^ g 1696 | } 1697 | a = this._0; 1698 | this._0 = this._1; 1699 | this._1 = a; 1700 | j.call(this, 1, 1431655765); 1701 | l.call(this, 8, 16711935); 1702 | l.call(this, 2, 858993459); 1703 | j.call(this, 16, 65535); 1704 | j.call(this, 4, 252645135); 1705 | b[c] = this._0; 1706 | b[c + 1] = this._1 1707 | }, 1708 | keySize: 2, 1709 | ivSize: 2, 1710 | blockSize: 2 1711 | }); 1712 | h.DES = e._5(m); 1713 | g = g.TripleDES = e.extend({ 1714 | _7: function () { 1715 | var b = this._13.words; 1716 | this._24 = m.createEncryptor(n.create(b.slice(0, 2))); 1717 | this._21 = m.createEncryptor(n.create(b.slice(2, 4))); 1718 | this._22 = m.createEncryptor(n.create(b.slice(4, 6))) 1719 | }, 1720 | encryptBlock: function (b, c) { 1721 | this._24.encryptBlock(b, c); 1722 | this._21.decryptBlock(b, c); 1723 | this._22.encryptBlock(b, c) 1724 | }, 1725 | decryptBlock: function (b, c) { 1726 | this._22.decryptBlock(b, c); 1727 | this._21.encryptBlock(b, c); 1728 | this._24.decryptBlock(b, c) 1729 | }, 1730 | keySize: 6, 1731 | ivSize: 2, 1732 | blockSize: 2 1733 | }); 1734 | h.TripleDES = e._5(g) 1735 | })(); 1736 | const aes_server_key = "efsdsbafa6xFe8lcg=="; 1737 | const aes_server_iv = "o2muxyVs5cwedbQ=="; 1738 | const aes_client_key = "weJGsdsdf6FxF9=="; 1739 | const aes_client_iv = "sewg29nsl="; 1740 | const des_key = "sgfsfKsg8723jF=="; 1741 | const des_iv = "yfw3wexsd="; 1742 | const aes_local_key = 'emhlbnFpcGFsbWtleQ=='; 1743 | const aes_local_iv = 'emhlbnFpcGFsbWl2'; 1744 | var BASE64 = { 1745 | encrypt: function (text) { 1746 | var b = new Base64(); 1747 | return b.encode(text) 1748 | }, 1749 | decrypt: function (text) { 1750 | var b = new Base64(); 1751 | return b.decode(text) 1752 | } 1753 | }; 1754 | var DES = { 1755 | encrypt: function (text, key, iv) { 1756 | var secretkey = (CryptoJS.MD5(key).toString()).substr(0, 16); 1757 | var secretiv = (CryptoJS.MD5(iv).toString()).substr(24, 8); 1758 | secretkey = CryptoJS.enc.Utf8.parse(secretkey); 1759 | secretiv = CryptoJS.enc.Utf8.parse(secretiv); 1760 | var result = CryptoJS.DES.encrypt(text, secretkey, { 1761 | iv: secretiv, 1762 | mode: CryptoJS.mode.CBC, 1763 | padding: CryptoJS.pad.Pkcs7 1764 | }); 1765 | return result.toString() 1766 | }, 1767 | decrypt: function (text, key, iv) { 1768 | var secretkey = (CryptoJS.MD5(key).toString()).substr(0, 16); 1769 | var secretiv = (CryptoJS.MD5(iv).toString()).substr(24, 8); 1770 | secretkey = CryptoJS.enc.Utf8.parse(secretkey); 1771 | secretiv = CryptoJS.enc.Utf8.parse(secretiv); 1772 | var result = CryptoJS.DES.decrypt(text, secretkey, { 1773 | iv: secretiv, 1774 | mode: CryptoJS.mode.CBC, 1775 | padding: CryptoJS.pad.Pkcs7 1776 | }); 1777 | return result.toString(CryptoJS.enc.Utf8) 1778 | } 1779 | }; 1780 | var AES = { 1781 | encrypt: function (text, key, iv) { 1782 | var secretkey = (CryptoJS.MD5(key).toString()).substr(16, 16); 1783 | var secretiv = (CryptoJS.MD5(iv).toString()).substr(0, 16); 1784 | secretkey = CryptoJS.enc.Utf8.parse(secretkey); 1785 | secretiv = CryptoJS.enc.Utf8.parse(secretiv); 1786 | var result = CryptoJS.AES.encrypt(text, secretkey, { 1787 | iv: secretiv, 1788 | mode: CryptoJS.mode.CBC, 1789 | padding: CryptoJS.pad.Pkcs7 1790 | }); 1791 | return result.toString() 1792 | }, 1793 | decrypt: function (text, key, iv) { 1794 | var secretkey = (CryptoJS.MD5(key).toString()).substr(16, 16); 1795 | var secretiv = (CryptoJS.MD5(iv).toString()).substr(0, 16); 1796 | secretkey = CryptoJS.enc.Utf8.parse(secretkey); 1797 | secretiv = CryptoJS.enc.Utf8.parse(secretiv); 1798 | var result = CryptoJS.AES.decrypt(text, secretkey, { 1799 | iv: secretiv, 1800 | mode: CryptoJS.mode.CBC, 1801 | padding: CryptoJS.pad.Pkcs7 1802 | }); 1803 | return result.toString(CryptoJS.enc.Utf8) 1804 | } 1805 | }; 1806 | var localStorageUtil = { 1807 | save: function (name, value) { 1808 | var text = JSON.stringify(value); 1809 | text = BASE64.encrypt(text); 1810 | text = AES.encrypt(text, aes_local_key, aes_local_iv); 1811 | try { 1812 | localStorage.setItem(name, text) 1813 | } catch (oException) { 1814 | if (oException.name === 'QuotaExceededError') { 1815 | console.log('超出本地存储限额!'); 1816 | localStorage.clear(); 1817 | localStorage.setItem(name, text) 1818 | } 1819 | } 1820 | }, 1821 | check: function (name) { 1822 | return localStorage.getItem(name) 1823 | }, 1824 | getValue: function (name) { 1825 | var text = localStorage.getItem(name); 1826 | var result = null; 1827 | if (text) { 1828 | text = AES.decrypt(text, aes_local_key, aes_local_iv); 1829 | text = BASE64.decrypt(text); 1830 | result = JSON.parse(text) 1831 | } 1832 | return result 1833 | }, 1834 | remove: function (name) { 1835 | localStorage.removeItem(name) 1836 | } 1837 | }; 1838 | 1839 | function getDataFromLocalStorage(key, period) { 1840 | if (typeof period === 'undefined') { 1841 | period = 0 1842 | } 1843 | var d = DES.encrypt(key); 1844 | d = BASE64.encrypt(key); 1845 | var data = localStorageUtil.getValue(key); 1846 | if (data) { 1847 | const time = data.time; 1848 | const current = new Date().getTime(); 1849 | if (new Date().getHours() >= 0 && new Date().getHours() < 5 && period > 1) { 1850 | period = 1 1851 | } 1852 | if (current - (period * 60 * 60 * 1000) > time) { 1853 | data = null 1854 | } 1855 | if (new Date().getHours() >= 5 && new Date(time).getDate() !== new Date().getDate() && period === 24) { 1856 | data = null 1857 | } 1858 | } 1859 | return data 1860 | } 1861 | function ObjectSort(obj) { 1862 | var newObject = {}; 1863 | Object.keys(obj).sort().map(function (key) { 1864 | newObject[key] = obj[key] 1865 | }); 1866 | return newObject 1867 | } 1868 | function decodeData(data) { 1869 | data = BASE64.decrypt(data); 1870 | data = DES.decrypt(data, des_key, des_iv); 1871 | data = AES.decrypt(data, aes_server_key, aes_server_iv); 1872 | data = BASE64.decrypt(data); 1873 | return data 1874 | } 1875 | var getParam = (function () { 1876 | function ObjectSort(obj) { 1877 | var newObject = {}; 1878 | Object.keys(obj).sort().map(function (key) { 1879 | newObject[key] = obj[key] 1880 | }); 1881 | return newObject 1882 | } 1883 | return function (method, obj) { 1884 | var appId = 'b73a4aaa989f54997ef7b9c42b6b4b29'; 1885 | var clienttype = 'WEB'; 1886 | var timestamp = new Date().getTime(); 1887 | var param = { 1888 | appId: appId, 1889 | method: method, 1890 | timestamp: timestamp, 1891 | clienttype: clienttype, 1892 | object: obj, 1893 | secret: hex_md5(appId + method + timestamp + clienttype + JSON.stringify(ObjectSort(obj))) 1894 | }; 1895 | param = BASE64.encrypt(JSON.stringify(param)); 1896 | return AES.encrypt(param, aes_client_key, aes_client_iv) 1897 | } 1898 | })(); 1899 | 1900 | function getServerData(method, object, callback, period) { 1901 | const key = hex_md5(method + JSON.stringify(object)); 1902 | const data = getDataFromLocalStorage(key, period); 1903 | if (!data) { 1904 | var param = getParam(method, object); 1905 | $.ajax({ 1906 | url: 'api/historyapi.php', 1907 | data: { 1908 | hd: param 1909 | }, 1910 | type: "post", 1911 | success: function (data) { 1912 | data = decodeData(data); 1913 | obj = JSON.parse(data); 1914 | if (obj.success) { 1915 | if (period > 0) { 1916 | obj.result.time = new Date().getTime(); 1917 | localStorageUtil.save(key, obj.result) 1918 | } 1919 | callback(obj.result) 1920 | } else { 1921 | console.log(obj.errcode, obj.errmsg) 1922 | } 1923 | } 1924 | }) 1925 | } else { 1926 | callback(data) 1927 | } 1928 | } 1929 | 1930 | function getEncryptedData(method, city, month) { 1931 | var param = {}; 1932 | param.city = city; 1933 | param.month = month; 1934 | return getParam(method, param); 1935 | } -------------------------------------------------------------------------------- /proxy.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import time 3 | import hashlib 4 | 5 | # 个人中心获取orderno与secret 如果不用代理则不用设置 6 | orderno = "" 7 | secret = "" 8 | 9 | ip = "dynamic.xiongmaodaili.com" 10 | port = "8089" 11 | 12 | 13 | def get_proxy(): 14 | _version = sys.version_info 15 | is_python3 = (_version[0] == 3) 16 | ip_port = ip + ":" + port 17 | timestamp = str(int(time.time())) # 计算时间戳 18 | txt = "" 19 | txt = "orderno=" + orderno + "," + "secret=" + secret + "," + "timestamp=" + timestamp 20 | if is_python3: 21 | txt = txt.encode() 22 | md5_string = hashlib.md5(txt).hexdigest() # 计算sign 23 | sign = md5_string.upper() # 转换成大写 24 | auth = "sign=" + sign + "&" + "orderno=" + orderno + "&" + "timestamp=" + timestamp 25 | proxy = {"http": "http://" + ip_port} 26 | headers = {"Proxy-Authorization": auth} 27 | return headers, proxy 28 | -------------------------------------------------------------------------------- /temp/1.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Crack-DanShiFu/apiStudy/10d40cbdcadbad559d7f7ccd21734db658cc27b7/temp/1.xls -------------------------------------------------------------------------------- /usually_data.py: -------------------------------------------------------------------------------- 1 | # city = ['阿坝州', '安康', '阿克苏地区', '阿里地区', '阿拉善盟', '阿勒泰地区', '安庆', '安顺', '鞍山', '克孜勒苏州', '安阳', '蚌埠', '白城', '保定', '北海', '宝鸡', 2 | # '北京', '毕节', '博州', '白山', '百色', '保山', '白沙', '包头', '保亭', '本溪', '巴彦淖尔', '白银', '巴中', '滨州', '亳州', '长春', '昌都', '常德', 3 | # '成都', '承德', '赤峰', '昌吉州', '五家渠', '昌江', '澄迈', '重庆', '长沙', '常熟', '楚雄州', '朝阳', '沧州', '长治', '常州', '潮州', '郴州', '池州', 4 | # '崇左', '滁州', '定安', '丹东', '东方', '东莞', '德宏州', '大理州', '大连', '大庆', '大同', '定西', '大兴安岭地区', '德阳', '东营', '黔南州', '达州', 5 | # '德州', '儋州', '鄂尔多斯', '恩施州', '鄂州', '防城港', '佛山', '抚顺', '阜新', '阜阳', '富阳', '抚州', '福州', '广安', '贵港', '桂林', '果洛州', 6 | # '甘南州', '固原', '广元', '贵阳', '甘孜州', '赣州', '广州', '淮安', '海北州', '鹤壁', '淮北', '河池', '海东地区', '邯郸', '哈尔滨', '合肥', '鹤岗', 7 | # '黄冈', '黑河', '红河州', '怀化', '呼和浩特', '海口', '呼伦贝尔', '葫芦岛', '哈密地区', '海门', '海南州', '淮南', '黄南州', '衡水', '黄山', '黄石', 8 | # '和田地区', '海西州', '河源', '衡阳', '汉中', '杭州', '菏泽', '贺州', '湖州', '惠州', '吉安', '金昌', '晋城', '景德镇', '金华', '西双版纳州', '九江', 9 | # '吉林', '即墨', '江门', '荆门', '佳木斯', '济南', '济宁', '胶南', '酒泉', '句容', '湘西州', '金坛', '鸡西', '嘉兴', '江阴', '揭阳', '济源', '嘉峪关', 10 | # '胶州', '焦作', '锦州', '晋中', '荆州', '库尔勒', '开封', '黔东南州', '克拉玛依', '昆明', '喀什地区', '昆山', '临安', '六安', '来宾', '聊城', '临沧', 11 | # '娄底', '乐东', '廊坊', '临汾', '临高', '漯河', '丽江', '吕梁', '陇南', '六盘水', '拉萨', '乐山', '丽水', '凉山州', '陵水', '莱芜', '莱西', '临夏州', 12 | # '溧阳', '辽阳', '辽源', '临沂', '龙岩', '洛阳', '连云港', '莱州', '兰州', '林芝', '柳州', '泸州', '马鞍山', '牡丹江', '茂名', '眉山', '绵阳', '梅州', 13 | # '宁波', '南昌', '南充', '宁德', '内江', '南京', '怒江州', '南宁', '南平', '那曲地区', '南通', '南阳', '平度', '平顶山', '普洱', '盘锦', '蓬莱', '平凉', 14 | # '莆田', '萍乡', '濮阳', '攀枝花', '青岛', '琼海', '秦皇岛', '曲靖', '齐齐哈尔', '七台河', '黔西南州', '清远', '庆阳', '钦州', '衢州', '泉州', '琼中', 15 | # '荣成', '日喀则', '乳山', '日照', '韶关', '寿光', '上海', '绥化', '石河子', '石家庄', '商洛', '三明', '三门峡', '山南', '遂宁', '四平', '商丘', '宿迁', 16 | # '上饶', '汕头', '汕尾', '绍兴', '三亚', '邵阳', '沈阳', '十堰', '松原', '双鸭山', '深圳', '朔州', '宿州', '随州', '苏州', '石嘴山', '泰安', '塔城地区', 17 | # '太仓', '铜川', '屯昌', '通化', '天津', '铁岭', '通辽', '铜陵', '吐鲁番地区', '铜仁地区', '唐山', '天水', '太原', '台州', '泰州', '文昌', '文登', '潍坊', 18 | # '瓦房店', '威海', '乌海', '芜湖', '武汉', '吴江', '乌兰察布', '乌鲁木齐', '渭南', '万宁', '文山州', '武威', '无锡', '温州', '吴忠', '梧州', '五指山', 19 | # '西安', '兴安盟', '许昌', '宣城', '襄阳', '孝感', '迪庆州', '锡林郭勒盟', '厦门', '西宁', '咸宁', '湘潭', '邢台', '新乡', '咸阳', '新余', '信阳', '忻州', 20 | # '徐州', '雅安', '延安', '延边州', '宜宾', '盐城', '宜昌', '宜春', '银川', '运城', '伊春', '云浮', '阳江', '营口', '榆林', '玉林', '伊犁哈萨克州', '阳泉', 21 | # '玉树州', '烟台', '鹰潭', '义乌', '宜兴', '玉溪', '益阳', '岳阳', '扬州', '永州', '淄博', '自贡', '珠海', '湛江', '镇江', '诸暨', '张家港', '张家界', 22 | # '张家口', '周口', '驻马店', '章丘', '肇庆', '中山', '舟山', '昭通', '中卫', '张掖', '招远', '资阳', '遵义', '枣庄', '漳州', '郑州', '株洲'] 23 | # 24 | # 25 | # 一共384个 26 | 27 | 28 | USER_AGENTS = [ 29 | "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; AcooBrowser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)", 30 | "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Acoo Browser; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506)", 31 | "Mozilla/4.0 (compatible; MSIE 7.0; AOL 9.5; AOLBuild 4337.35; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)", 32 | "Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)", 33 | "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 2.0.50727; Media Center PC 6.0)", 34 | "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 1.0.3705; .NET CLR 1.1.4322)", 35 | "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.0.04506.30)", 36 | "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN) AppleWebKit/523.15 (KHTML, like Gecko, Safari/419.3) Arora/0.3 (Change: 287 c9dfb30)", 37 | "Mozilla/5.0 (X11; U; Linux; en-US) AppleWebKit/527+ (KHTML, like Gecko, Safari/419.3) Arora/0.6", 38 | "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2pre) Gecko/20070215 K-Ninja/2.1.1", 39 | "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9) Gecko/20080705 Firefox/3.0 Kapiko/3.0", 40 | "Mozilla/5.0 (X11; Linux i686; U;) Gecko/20070322 Kazehakase/0.4.5", 41 | "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8) Gecko Fedora/1.9.0.8-1.fc10 Kazehakase/0.5.6", 42 | "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11", 43 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.20 (KHTML, like Gecko) Chrome/19.0.1036.7 Safari/535.20", 44 | "Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; fr) Presto/2.9.168 Version/11.52", 45 | ] 46 | 47 | defult_data = "{'result':'{'data':'{'items':''}'}'}" 48 | 49 | target_type = ['time_point', 'aqi', 'pm2_5', 'pm10', 'so2', 'no2', 'co', 'o3', 'rank', 'quality'] 50 | 51 | years = [str(i + 2013) for i in range(7)] # 列表推导式得到年份数据 52 | month = [str(i if i > 9 else '0' + str(i)) for i in range(1, 13)] # 列表推导式得到月份数据 53 | -------------------------------------------------------------------------------- /utils.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | import json 3 | import logging 4 | import random 5 | import execjs 6 | import filelock 7 | import xlrd 8 | import xlwt 9 | from lxml import etree 10 | import requests 11 | from xlutils3 import copy 12 | from config import * 13 | from proxy import get_proxy 14 | from usually_data import target_type, USER_AGENTS, years, month 15 | import pymysql as mdb 16 | 17 | logging.basicConfig(filename='apiStudy.log', level=logging.DEBUG, format=LOG_FORMAT, datefmt=DATE_FORMAT) 18 | 19 | 20 | def day_params(city, date_time, ctx): 21 | method = 'GETDAYDATA' 22 | js = 'getEncryptedData("{0}", "{1}", "{2}")'.format(method, city, date_time) 23 | return ctx.eval(js) 24 | 25 | 26 | def month_params(city, date_time, ctx): 27 | method = 'GETMONTHDATA' 28 | js = 'getEncryptedData("{0}", "{1}", "{2}")'.format(method, city, date_time) 29 | return ctx.eval(js) 30 | 31 | 32 | # 解码response对象 33 | def decode_info(info, ctx): 34 | js = 'decodeData("{0}")'.format(info) 35 | data = ctx.eval(js) 36 | data = json.loads(data) 37 | return data 38 | 39 | 40 | def get_response(params): 41 | url = data_url 42 | headers = { 43 | 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 44 | 'Accept-Encoding': 'gzip, deflate', 45 | 'Accept-Language': 'zh-CN,zh;q=0.8', 46 | 'Content-Type': 'application/x-www-form-urlencoded', 47 | 'User-Agent': random.choice(USER_AGENTS) 48 | } 49 | data = { 50 | 'hd': params 51 | } 52 | proxies = {} 53 | # 动态代理 54 | # headers, proxies = get_proxy() 55 | html_info = requests.post(url, data=data, headers=headers, proxies=proxies) 56 | if html_info.status_code is 200: 57 | return html_info.text 58 | else: 59 | return None 60 | 61 | 62 | def get_city(): 63 | url = city_url 64 | html_info = requests.get(url) 65 | html = etree.HTML(html_info.text) # 初始化生成一个XPath解析对象 66 | items = html.xpath('//div[@class="all"]//a/text()') 67 | return items 68 | 69 | 70 | def get_city_data(): 71 | url = city_url 72 | html_info = requests.get(url) 73 | result = [] 74 | html = etree.HTML(html_info.text) # 初始化生成一个XPath解析对象 75 | items = html.xpath('//div[@class="all"]//ul[@class="unstyled"]') 76 | for i in items: 77 | cityName = i.xpath('div/li/a/text()') 78 | first_letter = i.xpath('div/b/text()') 79 | for c in cityName: 80 | result.append([c, first_letter[0][:-1]]) 81 | for k, v in enumerate(result): 82 | result[k].append(k) 83 | return result 84 | 85 | 86 | # 得到一个城市所有的历史数据 87 | def get_all_info_by_city(city): 88 | now_y, now_m, _ = datetime.datetime.now().strftime('%Y-%m-%d').split('-') 89 | node = execjs.get() 90 | ctx = node.compile(open('decrypt.js', encoding='utf-8').read()) 91 | result = [] 92 | for y in years: 93 | for m in month: 94 | if now_y == y and (int(now_m) < int(m)): 95 | break 96 | date_time = y + m # 201805 97 | html_info = get_response(day_params(city, date_time, ctx)) 98 | print('爬取' + date_time + city) 99 | if html_info is not None: 100 | item = decode_info(html_info, ctx) 101 | for i in item['result']['data']['items']: 102 | result.append(en_day_sdict_to_list(city, i)) 103 | return result 104 | 105 | 106 | # 得到一个城市最近一天的数据 107 | def get_least_info_by_city(city): 108 | now_y, now_m, _ = datetime.datetime.now().strftime('%Y-%m-%d').split('-') 109 | node = execjs.get() 110 | ctx = node.compile(open('decrypt.js', encoding='utf-8').read()) 111 | result = [] 112 | date_time = now_y + now_m # 201805 113 | html_info = get_response(day_params(city, date_time, ctx)) 114 | if html_info is not None: 115 | item = decode_info(html_info, ctx) 116 | last_num = len(item['result']['data']['items']) 117 | 118 | if last_num is 0: 119 | logging.info(city + '无最近数据或未更新') 120 | return [] 121 | logging.info('获取' + city + str(item['result']['data']['items'][-1]['time_point']) + '数据') 122 | return [en_day_sdict_to_list(city, item['result']['data']['items'][-1])] 123 | 124 | 125 | # 爬取某城市一年的日数据 126 | def get_year_info_by_city(year, city): 127 | now_y, now_m, _ = datetime.datetime.now().strftime('%Y-%m-%d').split('-') 128 | node = execjs.get() 129 | ctx = node.compile(open('decrypt.js', encoding='utf-8').read()) 130 | result = [] 131 | for m in month: 132 | if now_y == year and (int(now_m) < int(m)): 133 | break 134 | date_time = year + m # 201805 135 | html_info = get_response(day_params(city, date_time, ctx)) 136 | print('爬取' + date_time + city) 137 | if html_info is not None: 138 | item = decode_info(html_info, ctx) 139 | for i in item['result']['data']['items']: 140 | result.append(i) 141 | return result 142 | 143 | 144 | # 爬取某城市的月平均数据 145 | def get_month_average_info_by_city(city): 146 | now_y, now_m, _ = datetime.datetime.now().strftime('%Y-%m-%d').split('-') 147 | node = execjs.get() 148 | ctx = node.compile(open('decrypt.js', encoding='utf-8').read()) 149 | result = [] 150 | date_time = '' # 201805 151 | html_info = get_response(month_params(city, date_time, ctx)) 152 | if html_info is not None: 153 | item = decode_info(html_info, ctx) 154 | for i in item['result']['data']['items']: 155 | result.append(en_month_dict_to_list(city, i)) 156 | logging.info('获取' + city + str(i['time_point']) + '的月平均数据') 157 | return result 158 | 159 | 160 | def insert_db(result): 161 | conn = mdb.connect(host='127.0.0.1', port=3306, user='root', passwd='root', db='openApiStudy') 162 | cursor = conn.cursor() 163 | cursor.executemany( 164 | 'INSERT INTO day_data(cityName,time_point,aqi,pm2_5,pm10,so2,no2,co,o3,rank,quality) values(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)', 165 | result) 166 | conn.commit() 167 | conn.close() 168 | 169 | 170 | def insert_month_db(result): 171 | conn = mdb.connect(host='127.0.0.1', port=3306, user='root', passwd='root', db='openApiStudy') 172 | cursor = conn.cursor() 173 | cursor.executemany( 174 | 'INSERT INTO month_data(cityName,time_point,aqi,max_aqi,min_aqi,pm2_5,pm10,so2,no2,co,o3,rank,quality) values(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)', 175 | result) 176 | 177 | conn.commit() 178 | conn.close() 179 | 180 | 181 | def write_excel(result, ci, data_type): 182 | # rb = xlrd.open_workbook('1.xls', formatting_info=True) 183 | # wbk = xl_copy(rb) 184 | wbk = xlwt.Workbook() 185 | sheet = wbk.add_sheet(ci) 186 | for k, v in enumerate(data_type): 187 | sheet.write(0, k, v) 188 | for k, v in enumerate(result): 189 | for k1, v1 in enumerate(data_type): 190 | sheet.write(k + 1, k1, v[v1]) 191 | wbk.save('./day/' + ci + '.xls') 192 | 193 | 194 | def en_day_sdict_to_list(cityName, result): 195 | return [cityName, result['time_point'], result['aqi'], result['pm2_5'], result['pm10'], result['so2'], 196 | result['no2'], result['co'], result['o3'], 197 | result['rank'], result['quality']] 198 | 199 | 200 | def en_month_dict_to_list(cityName, result): 201 | return [cityName, result['time_point'], result['aqi'], result['max_aqi'], result['min_aqi'], result['pm2_5'], 202 | result['pm10'], result['so2'], 203 | result['no2'], result['co'], result['o3'], 204 | result['rank'], result['quality']] 205 | -------------------------------------------------------------------------------- /yue.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Crack-DanShiFu/apiStudy/10d40cbdcadbad559d7f7ccd21734db658cc27b7/yue.xls --------------------------------------------------------------------------------