-
Notifications
You must be signed in to change notification settings - Fork 1
/
麦卡钱包.py
83 lines (72 loc) · 2.13 KB
/
麦卡钱包.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/1/30 0030 14:09
# @Author : Chihiro
# @Site :
# @File : 麦卡钱包.py
# @Software: PyCharm
from datetime import date, datetime
from scrapy import Selector
from Frame.Crawler import BaseSpider
from Frame.Request import Request
from time import sleep
import time
import json
class Spider(BaseSpider, Request):
def __init__(self, account):
super(Spider, self).__init__(account)
def get_info(self):
xpath_info = {
"username": '//*[@id="username$text"]',
"password": '//*[@id="pwd$text"]',
"login_button": '//*[@id="loginForm"]/table/tbody/tr[3]/td[2]/a[1]/span/span',
"message_code": '',
"check_code": '',
"code_image": '',
"success_ele": '//*[@id="1$cell$3"]'
}
# 获取Cookie值
cookie = self.login(xpath_info)
# page的url
page_url = "http://www.mashpay.live/admin/data/channels.php?method=channelRegisterUsersList"
# 设置参数
t1 = date.today()
now = int(time.mktime(t1.timetuple()))
arg = {
'startTime': now,
'endTime': now,
'pageIndex': 0,
'pageSize': 10,
'sortField': "",
'sortOrder': ""
}
info = json.loads(self.request(page_url, cookie_dict=cookie, method="post", args=arg))
# 获取结果
print(info)
result = {
"注册人数": info['total'],
"实名人数": "null",
"申请人数": "null",
"放款人数": "null",
"备注": "",
"地区": self.area,
"产品要求": self.requirements
}
self.write_sql(result)
SH = {
"login_url": "http://www.mashpay.live/loginLayout.html",
"area": 0,
"product": "麦卡钱包",
"username": "jsd24",
"password": "123456",
"message_code": "",
"channel": "",
"requirements": "下款3%",
"remark": ""
}
account_info = [SH]
while True:
for i in account_info:
product = Spider(i)
product.get_info()
time.sleep(1200)