├── .gitignore ├── .ipynb_checkpoints └── Untitled-checkpoint.ipynb ├── JD ├── .ipynb_checkpoints │ └── Untitled-checkpoint.ipynb ├── Untitled.ipynb ├── __init__.py ├── cookies.pkl └── main.py ├── README.md ├── Untitled.ipynb ├── check_in.py ├── jd.py ├── main.py ├── now └── main.py ├── sign_in.py ├── suning ├── __init__.py └── main.py ├── taobao └── miaobi.py ├── xeuqiu └── main.py └── zhifubao └── alipay_red.py /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.pyc 3 | data.cfg 4 | setting.json 5 | keys.json 6 | config.py -------------------------------------------------------------------------------- /.ipynb_checkpoints/Untitled-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [], 3 | "metadata": {}, 4 | "nbformat": 4, 5 | "nbformat_minor": 2 6 | } 7 | -------------------------------------------------------------------------------- /JD/.ipynb_checkpoints/Untitled-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [], 3 | "metadata": {}, 4 | "nbformat": 4, 5 | "nbformat_minor": 2 6 | } 7 | -------------------------------------------------------------------------------- /JD/Untitled.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 5, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "# -*-coding=utf-8-*-\n", 10 | "import pickle\n", 11 | "import requests\n", 12 | "import time\n", 13 | "\n", 14 | "from selenium import webdriver\n", 15 | "import json\n", 16 | "\n", 17 | "\n", 18 | "with open('keys.json','r') as f:\n", 19 | " jsn=json.load(f)\n", 20 | " user=jsn.get('user')\n", 21 | " password=jsn.get('password')\n", 22 | "options = webdriver.ChromeOptions()\n", 23 | "options.add_argument(\n", 24 | " '--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36')\n", 25 | " # options.add_argument('--headless')\n", 26 | "options.add_argument('--disable-gpu')\n", 27 | "browser = webdriver.Chrome(executable_path=r'C:\\OneDrive\\Python\\selenium\\chromedriver.exe',\n", 28 | " chrome_options=options)\n", 29 | "\n", 30 | "browser.implicitly_wait(10)\n", 31 | "url = 'https://passport.jd.com/new/login.aspx'\n", 32 | "browser.get(url)\n", 33 | "\n", 34 | "browser.find_element_by_css_selector('div.login-tab.login-tab-r').click()\n", 35 | "\n", 36 | "browser.find_element_by_id('loginname').send_keys(user)\n", 37 | "browser.find_element_by_id('nloginpwd').send_keys(password)\n", 38 | "browser.find_element_by_css_selector('div.login-btn').click()\n", 39 | "\n", 40 | "browser.find_element_by_css_selector('li.shortcut_btn.fore3.dorpdown').click()" 41 | ] 42 | }, 43 | { 44 | "cell_type": "code", 45 | "execution_count": 6, 46 | "metadata": {}, 47 | "outputs": [ 48 | { 49 | "data": { 50 | "text/plain": [ 51 | "u'\\n \\n \\u4eac\\u4e1c(JD.COM)-\\u6b63\\u54c1\\u4f4e\\u4ef7\\u3001\\u54c1\\u8d28\\u4fdd\\u969c\\u3001\\u914d\\u9001\\u53ca\\u65f6\\u3001\\u8f7b\\u677e\\u8d2d\\u7269\\uff01\\n \\n \\n \\n\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n\\n \\n\\n\\n \\n\\n\\n \\n \\n\\n
\\n\\n
\\ue600
\\n\\n\\n
\\n
\\n
\\n

\\n \\u4eac\\u4e1c\\n

\\n

\\u4eac\\u4e1c,\\u591a\\u5feb\\u597d\\u7701

\\n
\\n
\\n \\n
\\n
\\n \\n
    \\n \\n
    \\n
    \\n \\n
    \\n
    \\n
    \\n \\n
    \\n
    \\n \\n >0\\n \\ue607\\n \\u6211\\u7684\\u8d2d\\u7269\\u8f66\\n
    \\n
    \\n
    \\n \\n \\n \\n
    \\n \\n \\t\\t
    \\n\\t\\t \\n \\t\\t
    \\n\\t\\t \\n
    \\n \\n
    \\n
    \\n
    \\n\\n
    \\n\\t\\u5c0f\\u7c735X\\u8ddf\\u8363\\u8000\\u7545\\u73a96X\\u54ea\\u4e2a\\u597d\\n\\t\\u5c0f\\u7c735X\\u62cd\\u7167\\u600e\\u4e48\\u6837\\n\\t\\u5973\\u58eb\\u5305\\u5305\\u54c1\\u724c\\u6392\\u884c\\u699c\\n\\t\\u5b8c\\u7f8e\\u82a6\\u835f\\u80f6\\u8fd9\\u6b3e\\u80fd\\u6d82\\u773c\\u775b\\u5468\\u56f4\\u5417\\uff1f\\u5f53\\u773c\\u971c\\u4f7f\\u7528\\uff1f\\n\\t\\u5973\\u58eb\\u624b\\u63d0\\u5305\\n\\t\\u7537\\u751f\\u624b\\u8868\\u54c1\\u724c\\u6392\\u884c\\u699c\\n\\t\\u8bc4\\u6d4b\\u4f53\\u9a8c\\n\\t\\u4eac\\u4e1c\\u4f18\\u8bc4\\n\\tTCL\\u5168\\u81ea\\u52a8\\u6d17\\u8863\\u673a\\n\\t\\u864e\\u724c\\u5bb6\\u7528\\u7535\\u70ed\\u6c34\\u74f6\\n\\t\\u8461\\u8404\\u9152\\n\\t\\u4f18\\u8bc4M\\u7248\\n\\t\\u5361\\u6885\\u7f57\\u897f\\u8461\\u8404\\u9152\\n\\t\\u4f11\\u95f2\\u978b\\n\\t\\u6d01\\u67d4\\u7eb8\\u54c1\\u6e7f\\u5dfe\\n\\tAppleiPad\\u80fd\\u63a5wifi\\u5417\\uff1f\\n\\tAppleiPhone7\\u516c\\u5f00\\u7248\\u548c\\u53cc\\u7f51\\u901a\\u6709\\u5565\\u533a\\u522b\\uff1f\\n\\t\\u77ed\\u6b3e\\u96ea\\u7eba\\u886b\\n\\t\\u7f8e\\u7684MB-WFS4029\\u5927\\u5bb6\\u600e\\u6837\\u9009\\u62e9\\u529f\\u80fd\\u7684\\n\\tAppleiPad\\u8fd0\\u884c\\u5185\\u5b58\\u662f\\u591a\\u5927\\u7684\\uff1f\\n\\t\\u6d77\\u5c14\\u51b0\\u7bb1bcd216\\n\\t\\u6d77\\u5c14\\u7edf\\u5e05Leader\\n\\t\\u6d77\\u5c14\\u51b0\\u7bb1bcd301\\n\\t\\u6d77\\u5c14Leader\\u7edf\\u5e05\\n\\t\\u5bb9\\u58f0Ronshen\\n\\t\\u51b0\\u7bb1BCD206\\n\\t\\u897f\\u95e8\\u5b50SIEMENS\\n\\t\\u5bb9\\u58f0BCD\\n\\t\\u7f8e\\u768460l\\n\\t\\u8ff7\\u4f60\\u51b0\\u7bb150l\\n\\t\\u8f66\\u8f7d220v\\u7535\\u70ed\\u676f\\n\\t\\u6d77\\u5c1450l\\u51b0\\u7bb1\\n\\t\\u677e\\u4e0b320c\\n\\t\\u6d77\\u5c14bcd216\\n\\t\\u6d77\\u5c14\\u51b0\\u7bb150L\\n\\t\\u51b0\\u7bb190L\\n\\t\\u51b0\\u7bb1130l\\n\\t\\u6d77\\u5c14bcd215\\n\\t\\u897f\\u95e8\\u5b50siemens\\u51b0\\u7bb1\\n\\t\\u6d77\\u5c14\\u51b0\\u7bb1bcd215\\n
    \\n\\n
    \\n
    \\n
    \\n
    \\n \\n
    \\n
    \\n\\n
    \\n \\n
    \\n
  • \"\"
  • \"2.1-\\u667a\\u80fd\"
  • \"\\u5b9d\\u6d01\\u5e74\\u8d27\\u8282\\u4e13\\u573a\"
  • \"2.1-\\u6d77\\u6f9c\\u4e4b\\u5bb6\"
  • \"\\u534e\\u4e3a\"
  • \\n
    \\n \\n
    \\n
    \\n
    \\n \\n
    \\n\\n\\n\\n\\n\\n
    \\n
    \\n
    \\n
    \\n\\n\\n
    \\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\n\\n\\n\\n\\n\\n
    \\u4eac\\u4e1c\\u4f1a\\u5458 0
    \\u6210\\u529f\\u52a0\\u5165\\u8d2d\\u7269\\u8f66!
    \\u8d2d\\u7269\\u8f66 0
    \\u6210\\u529f\\u52a0\\u5165\\u8d2d\\u7269\\u8f66!
    \\u6211\\u7684\\u5173\\u6ce8 0
    \\u6210\\u529f\\u52a0\\u5165\\u8d2d\\u7269\\u8f66!
    \\u6211\\u7684\\u8db3\\u8ff9 0
    \\u6210\\u529f\\u52a0\\u5165\\u8d2d\\u7269\\u8f66!
    \\u6211\\u7684\\u6d88\\u606f 0
    \\u6210\\u529f\\u52a0\\u5165\\u8d2d\\u7269\\u8f66!
    \\u54a8\\u8be2JIMI 0
    \\u6210\\u529f\\u52a0\\u5165\\u8d2d\\u7269\\u8f66!
    '" 52 | ] 53 | }, 54 | "execution_count": 6, 55 | "metadata": {}, 56 | "output_type": "execute_result" 57 | } 58 | ], 59 | "source": [ 60 | "browser.page_source" 61 | ] 62 | }, 63 | { 64 | "cell_type": "code", 65 | "execution_count": 14, 66 | "metadata": {}, 67 | "outputs": [ 68 | { 69 | "data": { 70 | "text/plain": [ 71 | "u'\\u5f85\\u5904\\u7406\\u8ba2\\u53552'" 72 | ] 73 | }, 74 | "execution_count": 14, 75 | "metadata": {}, 76 | "output_type": "execute_result" 77 | } 78 | ], 79 | "source": [ 80 | "browser.find_element_by_xpath('//div[@class=\"fore1\"]/div[@class=\"item\"]/a').text" 81 | ] 82 | }, 83 | { 84 | "cell_type": "code", 85 | "execution_count": 15, 86 | "metadata": {}, 87 | "outputs": [ 88 | { 89 | "name": "stdout", 90 | "output_type": "stream", 91 | "text": [ 92 | "待处理订单2\n" 93 | ] 94 | } 95 | ], 96 | "source": [ 97 | "print u'\\u5f85\\u5904\\u7406\\u8ba2\\u53552'" 98 | ] 99 | }, 100 | { 101 | "cell_type": "code", 102 | "execution_count": null, 103 | "metadata": {}, 104 | "outputs": [], 105 | "source": [ 106 | "browser.execute_script('return ')" 107 | ] 108 | } 109 | ], 110 | "metadata": { 111 | "kernelspec": { 112 | "display_name": "Python 2", 113 | "language": "python", 114 | "name": "python2" 115 | }, 116 | "language_info": { 117 | "codemirror_mode": { 118 | "name": "ipython", 119 | "version": 2 120 | }, 121 | "file_extension": ".py", 122 | "mimetype": "text/x-python", 123 | "name": "python", 124 | "nbconvert_exporter": "python", 125 | "pygments_lexer": "ipython2", 126 | "version": "2.7.13" 127 | } 128 | }, 129 | "nbformat": 4, 130 | "nbformat_minor": 2 131 | } 132 | -------------------------------------------------------------------------------- /JD/__init__.py: -------------------------------------------------------------------------------- 1 | #-*-coding=utf-8-*- 2 | 3 | def main(): 4 | 5 | 6 | if __name__ == '__main__': 7 | main() -------------------------------------------------------------------------------- /JD/cookies.pkl: -------------------------------------------------------------------------------- 1 | (lp0 2 | (dp1 3 | Vdomain 4 | p2 5 | Vpassport.jd.com 6 | p3 7 | sVname 8 | p4 9 | Valc 10 | p5 11 | sVvalue 12 | p6 13 | VshytSQKXjNtKYB+bbJdrlw== 14 | p7 15 | sVpath 16 | p8 17 | V/ 18 | p9 19 | sVhttpOnly 20 | p10 21 | I01 22 | sVsecure 23 | p11 24 | I00 25 | sa(dp12 26 | Vdomain 27 | p13 28 | Vpassport.jd.com 29 | p14 30 | sVname 31 | p15 32 | Vqr_t 33 | p16 34 | sVvalue 35 | p17 36 | Vc 37 | p18 38 | sVpath 39 | p19 40 | g9 41 | sVhttpOnly 42 | p20 43 | I01 44 | sVsecure 45 | p21 46 | I00 47 | sa(dp22 48 | Vdomain 49 | p23 50 | V.jd.com 51 | p24 52 | sVsecure 53 | p25 54 | I00 55 | sVvalue 56 | p26 57 | V1517397605324 58 | p27 59 | sVexpiry 60 | p28 61 | I1517399405 62 | sVpath 63 | p29 64 | g9 65 | sVhttpOnly 66 | p30 67 | I00 68 | sVname 69 | p31 70 | V_jrdb 71 | p32 72 | sa(dp33 73 | Vdomain 74 | p34 75 | Vpassport.jd.com 76 | p35 77 | sVname 78 | p36 79 | V_t 80 | p37 81 | sVvalue 82 | p38 83 | VuzFFNza8mTQS5Fe0s6h6qbp0i+DZED5StyBwJwdz/w4= 84 | p39 85 | sVpath 86 | p40 87 | g9 88 | sVhttpOnly 89 | p41 90 | I00 91 | sVsecure 92 | p42 93 | I00 94 | sa(dp43 95 | Vdomain 96 | p44 97 | V.jd.com 98 | p45 99 | sVsecure 100 | p46 101 | I00 102 | sVvalue 103 | p47 104 | V122270672.15173976047891584018956.1517397605.1517397605.1517397605.1 105 | p48 106 | sVexpiry 107 | p49 108 | I1532949604 109 | sVpath 110 | p50 111 | g9 112 | sVhttpOnly 113 | p51 114 | I00 115 | sVname 116 | p52 117 | V__jda 118 | p53 119 | sa(dp54 120 | Vdomain 121 | p55 122 | V.jd.com 123 | p56 124 | sVsecure 125 | p57 126 | I00 127 | sVvalue 128 | p58 129 | V122270672.1.15173976047891584018956|1.1517397605 130 | p59 131 | sVexpiry 132 | p60 133 | I1517399404 134 | sVpath 135 | p61 136 | g9 137 | sVhttpOnly 138 | p62 139 | I00 140 | sVname 141 | p63 142 | V__jdb 143 | p64 144 | sa(dp65 145 | Vdomain 146 | p66 147 | V.jd.com 148 | p67 149 | sVname 150 | p68 151 | V__jdc 152 | p69 153 | sVvalue 154 | p70 155 | V122270672 156 | p71 157 | sVpath 158 | p72 159 | g9 160 | sVhttpOnly 161 | p73 162 | I00 163 | sVsecure 164 | p74 165 | I00 166 | sa(dp75 167 | Vdomain 168 | p76 169 | V.jd.com 170 | p77 171 | sVname 172 | p78 173 | Vwlfstk_smdl 174 | p79 175 | sVvalue 176 | p80 177 | V5utlvxrmyjhbawqg3nvxzk50a4vy3jf9 178 | p81 179 | sVpath 180 | p82 181 | g9 182 | sVhttpOnly 183 | p83 184 | I00 185 | sVsecure 186 | p84 187 | I00 188 | sa(dp85 189 | Vdomain 190 | p86 191 | V.jd.com 192 | p87 193 | sVsecure 194 | p88 195 | I00 196 | sVvalue 197 | p89 198 | V1 199 | p90 200 | sVexpiry 201 | p91 202 | I1532949605 203 | sVpath 204 | p92 205 | g9 206 | sVhttpOnly 207 | p93 208 | I00 209 | sVname 210 | p94 211 | V_jrda 212 | p95 213 | sa(dp96 214 | Vdomain 215 | p97 216 | V.jd.com 217 | p98 218 | sVsecure 219 | p99 220 | I00 221 | sVvalue 222 | p100 223 | V122270672|direct|-|none|-|1517397604789 224 | p101 225 | sVexpiry 226 | p102 227 | I1518693604 228 | sVpath 229 | p103 230 | g9 231 | sVhttpOnly 232 | p104 233 | I00 234 | sVname 235 | p105 236 | V__jdv 237 | p106 238 | sa(dp107 239 | Vdomain 240 | p108 241 | V.jd.com 242 | p109 243 | sVsecure 244 | p110 245 | I00 246 | sVvalue 247 | p111 248 | VOVDYFIFBXBFTLIVSKMBHVF4H4VJAXMHZ4P24FZEN6L5DKU37N5MER7LTJY5E3TNH2VCWBZMC7HPTMXYLSDF6KV4FKU 249 | p112 250 | sVexpiry 251 | p113 252 | I1924905600 253 | sVpath 254 | p114 255 | g9 256 | sVhttpOnly 257 | p115 258 | I00 259 | sVname 260 | p116 261 | V3AB9D23F7A4B3C9B 262 | p117 263 | sa(dp118 264 | Vdomain 265 | p119 266 | V.jd.com 267 | p120 268 | sVsecure 269 | p121 270 | I00 271 | sVvalue 272 | p122 273 | V15173976047891584018956 274 | p123 275 | sVexpiry 276 | p124 277 | F1532949618.790031 278 | sVpath 279 | p125 280 | g9 281 | sVhttpOnly 282 | p126 283 | I00 284 | sVname 285 | p127 286 | V__jdu 287 | p128 288 | sa. -------------------------------------------------------------------------------- /JD/main.py: -------------------------------------------------------------------------------- 1 | # -*-coding=utf-8-*- 2 | import pickle 3 | import requests 4 | import time 5 | 6 | from selenium import webdriver 7 | import json 8 | 9 | def jd(): 10 | with open('keys.json','r') as f: 11 | jsn=json.load(f) 12 | user=jsn.get('user') 13 | password=jsn.get('password') 14 | options = webdriver.ChromeOptions() 15 | options.add_argument( 16 | '--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36') 17 | # options.add_argument('--headless') 18 | options.add_argument('--disable-gpu') 19 | browser = webdriver.Chrome(executable_path=r'C:\OneDrive\Python\selenium\chromedriver.exe', 20 | chrome_options=options) 21 | 22 | browser.implicitly_wait(60) 23 | url = 'https://passport.jd.com/new/login.aspx' 24 | browser.get(url) 25 | # time.sleep(10) 26 | browser.find_element_by_css_selector('div.login-tab.login-tab-r').click() 27 | # time.sleep(10) 28 | browser.find_element_by_id('loginname').send_keys(user) 29 | browser.find_element_by_id('nloginpwd').send_keys(password) 30 | browser.find_element_by_css_selector('div.login-btn').click() 31 | # time.sleep(100) 32 | # browser.find_element_by_css_selector('div.dt').click() 33 | # browser.find_element_by_css_selector('li.shortcut_btn.fore3.dorpdown').click() 34 | browser.find_element_by_css_selector('li.shortcut_btn.fore3.dorpdown').click() 35 | time.sleep(5) 36 | print browser.find_element_by_css_selector('dl.fore3.dd.fore3_10') 37 | browser.find_element_by_css_selector('dl.fore3.dd.fore3_10').click() 38 | browser.find_element_by_css_selector('a.btn-gutter').click() 39 | time.sleep(10) 40 | # browser.find_element_by_xpath('//li[@class="fore3 dorpdown"]/div').click() 41 | # cookie = browser.get_cookies() 42 | # browser.close() 43 | # time.sleep(100) 44 | # browser.get('https://bean.jd.com/myJingBean/list') 45 | # time.sleep(10) 46 | 47 | # browser.find_elements_by_css_selector('div.dt.cw-icon')[2].click() 48 | # for i in x: 49 | # i.click() 50 | # cookie = browser.get_cookies() 51 | # print cookie 52 | # time.sleep(20) 53 | # pickle.dump(cookie, open("cookies.pkl", "wb")) 54 | # browser.get("http://www.baidu.com") 55 | # browser.find_element_by_id("kw").clear() 56 | # browser.find_element_by_id("kw").send_keys("selenium") 57 | # browser.find_element_by_id("su").click() 58 | # browser.quit() 59 | # time.sleep(20) 60 | # cookie = {} 61 | # 转换dict调用 62 | # for item in cookie: 63 | # cookie[item['name']] = item['value'] 64 | # 65 | # url = 'https://home.jd.com' 66 | # header = { 67 | # 'Host': 'home.jd.com', 68 | # 'Pragma': 'no-cache', 69 | # 'Upgrade-Insecure-Requests': '1', 70 | # 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36' 71 | # } 72 | # response = requests.get(url, headers=header, cookies=cookie) 73 | # print response.text 74 | 75 | 76 | def check_login(): 77 | import pickle 78 | import requests 79 | 80 | cookies = pickle.load(open("cookies.pkl", "rb")) 81 | 82 | s = requests.Session() 83 | for cookie in cookies: 84 | s.cookies.set(cookie['name'], cookie['value']) 85 | response = s.get("https://www.jd.com") 86 | bodyStr = response.text 87 | print bodyStr 88 | 89 | 90 | if __name__ == '__main__': 91 | jd() 92 | # check_login() 93 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # red_bag 2 | 雪球红包/苏宁易购/京东/淘宝自动签到 领取金币 3 | 4 | * 20201201:支付宝理财红包领取 操作视频:https://v.qq.com/x/page/k3206w85ra9.html 5 | * 2019淘宝双十一领取喵币 -python 6 | * 自动抢雪球红包 -------------------------------------------------------------------------------- /Untitled.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 3, 6 | "metadata": {}, 7 | "outputs": [ 8 | { 9 | "ename": "IOError", 10 | "evalue": "[Errno 2] No such file or directory: 'keys.json'", 11 | "output_type": "error", 12 | "traceback": [ 13 | "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", 14 | "\u001b[1;31mIOError\u001b[0m Traceback (most recent call last)", 15 | "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 8\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 9\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 10\u001b[1;33m \u001b[1;32mwith\u001b[0m \u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'keys.json'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m'r'\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0mf\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 11\u001b[0m \u001b[0mjsn\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mjson\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mload\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mf\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 12\u001b[0m \u001b[0muser\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mjsn\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'user'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", 16 | "\u001b[1;31mIOError\u001b[0m: [Errno 2] No such file or directory: 'keys.json'" 17 | ] 18 | } 19 | ], 20 | "source": [ 21 | "# -*-coding=utf-8-*-\n", 22 | "import pickle\n", 23 | "import requests\n", 24 | "import time\n", 25 | "\n", 26 | "from selenium import webdriver\n", 27 | "import json\n", 28 | "\n", 29 | "\n", 30 | "with open('keys.json','r') as f:\n", 31 | " jsn=json.load(f)\n", 32 | " user=jsn.get('user')\n", 33 | " password=jsn.get('password')\n", 34 | "options = webdriver.ChromeOptions()\n", 35 | "options.add_argument(\n", 36 | " '--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36')\n", 37 | " # options.add_argument('--headless')\n", 38 | "options.add_argument('--disable-gpu')\n", 39 | "browser = webdriver.Chrome(executable_path=r'C:\\OneDrive\\Python\\selenium\\chromedriver.exe',\n", 40 | " chrome_options=options)\n", 41 | "\n", 42 | "browser.implicitly_wait(60)\n", 43 | "url = 'https://passport.jd.com/new/login.aspx'\n", 44 | "browser.get(url)\n", 45 | "\n", 46 | "browser.find_element_by_css_selector('div.login-tab.login-tab-r').click()\n", 47 | "\n", 48 | "browser.find_element_by_id('loginname').send_keys(user)\n", 49 | "browser.find_element_by_id('nloginpwd').send_keys(password)\n", 50 | "browser.find_element_by_css_selector('div.login-btn').click()\n", 51 | "\n", 52 | "browser.find_element_by_css_selector('li.shortcut_btn.fore3.dorpdown').click()\n", 53 | "\n" 54 | ] 55 | }, 56 | { 57 | "cell_type": "code", 58 | "execution_count": null, 59 | "metadata": {}, 60 | "outputs": [], 61 | "source": [] 62 | } 63 | ], 64 | "metadata": { 65 | "kernelspec": { 66 | "display_name": "Python 2", 67 | "language": "python", 68 | "name": "python2" 69 | }, 70 | "language_info": { 71 | "codemirror_mode": { 72 | "name": "ipython", 73 | "version": 2 74 | }, 75 | "file_extension": ".py", 76 | "mimetype": "text/x-python", 77 | "name": "python", 78 | "nbconvert_exporter": "python", 79 | "pygments_lexer": "ipython2", 80 | "version": "2.7.13" 81 | } 82 | }, 83 | "nbformat": 4, 84 | "nbformat_minor": 2 85 | } 86 | -------------------------------------------------------------------------------- /check_in.py: -------------------------------------------------------------------------------- 1 | # -*-coding=utf-8-*- 2 | __author__ = 'Rocky' 3 | # 对各种app进行签到 4 | from uiautomator import device as d 5 | import time, subprocess, sys 6 | 7 | global displayWidth 8 | global displayHeight 9 | displayWidth_cuizi = 1080 10 | displayHeight_cuizi = 1920 11 | 12 | 13 | # 启动app 14 | def launch_app(activity_name): 15 | try: 16 | cmd = 'adb shell am start -n %s' % activity_name 17 | p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) 18 | print(p.stdout.read()) 19 | time.sleep(15) 20 | except Exception as e: 21 | print(e) 22 | return 23 | 24 | 25 | def get_info(): 26 | global displayWidth 27 | global displayHeight 28 | info = d.info 29 | displayWidth = info['displayWidth'] 30 | displayHeight = info['displayHeight'] 31 | print("x={}, y={}".format(displayWidth,displayHeight)) 32 | 33 | 34 | def lnsh(): 35 | activity_name = 'com.vpclub.lnyp/.activity.SplashActivity' 36 | launch_app(activity_name) 37 | time.sleep(9) 38 | remove_ad_x = 944 39 | remove_ad_y = 447 40 | d.click(remove_ad_x, remove_ad_y) 41 | time.sleep(2) 42 | lucky_x = 143 43 | lucky_y = 678 44 | d.click(lucky_x, lucky_y) 45 | time.sleep(8) 46 | 47 | go_x = 545 48 | go_y = 1033 49 | d.click(go_x, go_y) 50 | time.sleep(9) 51 | print("Ling nan shen huo Done") 52 | 53 | 54 | def suning_cuizi(): 55 | # 苏宁在6点之后 56 | global displayWidth 57 | global displayHeight 58 | d.screen.on() 59 | d.press.home() 60 | ''' 61 | #解锁,没有密码的情况下 62 | sx=560 63 | sy=1700 64 | ex=560 65 | ey=900 66 | #d.swipe(sx,sy,ex,ey,steps=2) 67 | 68 | #d(scrollable=True).fling.horiz.forward() 69 | #d(text=u'苏宁易购').swipe.right() 70 | home_swipe_sx=950 71 | home_swipe_sy=1350 72 | home_swipe_ex=450 73 | home_swipe_ey=1350 74 | while not d(text=u"苏宁易购").exists: 75 | d.swipe(home_swipe_sx,home_swipe_sy,home_swipe_ex,home_swipe_ey,steps=2) 76 | time.sleep(3) 77 | d(text=u'苏宁易购').click() 78 | #time.sleep(10) 79 | ''' 80 | activity_name = 'com.suning.mobile.ebuy/.base.host.InitialActivity' 81 | launch_app(activity_name) 82 | time.sleep(9) 83 | if not d(text=u'领云钻').wait.exists(timeout=20 * 1000): 84 | print("Failed to get the page") 85 | return 86 | d(text=u'领云钻').click() 87 | print("Click") 88 | yun_x = 551 89 | yun_y = 738 90 | 91 | # glaxy_x=yun_x*gallery*full/cuizi_full 92 | time.sleep(15) 93 | d.click(yun_x, yun_y) 94 | print("Click") 95 | time.sleep(10) 96 | 97 | daka_x = displayWidth / 2 98 | daka_y = displayHeight / 2 + 100 99 | d.click(daka_x, daka_y) 100 | print("Click") 101 | time.sleep(20) 102 | d.click(daka_x, daka_y) 103 | print("Click") 104 | d.click(daka_x, daka_y) 105 | print("Click") 106 | print("Sunning Done") 107 | 108 | 109 | def jd_cuizi(): 110 | d.screen.on() 111 | d.press.home() 112 | activity_name = 'com.jingdong.app.mall/.main.MainActivity' 113 | launch_app(activity_name) 114 | 115 | if not d(text=u'领京豆').wait.exists(timeout=20 * 1000): 116 | print("Failed to get the page") 117 | return 118 | d(text=u'领京豆').click() 119 | dou_x = 915 120 | dou_y = 300 121 | 122 | # glaxy_x=yun_x*gallery*full/cuizi_full 123 | time.sleep(15) 124 | d.click(dou_x, dou_y) 125 | time.sleep(2) 126 | d.click(dou_x, dou_y) 127 | print(u"京豆") 128 | time.sleep(3) 129 | get_x, get_y = 505, 900 130 | d.click(get_x, get_y) 131 | time.sleep(8) 132 | d.press.back() 133 | time.sleep(4) 134 | liuliang_x, liuliang_y = 731, 574 135 | d.click(liuliang_x, liuliang_y) 136 | time.sleep(10) 137 | ll_x, ll_y = 544, 432 138 | d.click(ll_x, ll_y) 139 | time.sleep(8) 140 | print('京东完成') 141 | ''' 142 | #点击使用功能 143 | d.press.back() 144 | time.sleep(4) 145 | d.press.back() 146 | time.sleep(4) 147 | no_ad_y=775 148 | ad_y=1250 149 | d.swipe(990,no_ad_y,100,no_ad_y) 150 | time.sleep(8) 151 | #因为这个坐标会改变,所以定义两个变量来操作 152 | d.click(990,no_ad_y) 153 | ''' 154 | ''' 155 | if d(text=u'全部').wait.exists(timeout=2000): 156 | d(text=u'全部').click() 157 | ''' 158 | ''' 159 | time.sleep(4) 160 | d(text=u'领流量').click() 161 | time.sleep(5) 162 | #这个签到好像找不到 163 | #d(text=u'签到').click() 164 | liuliang_x,liuliang_y=529,450 165 | d.click(liuliang_x,liuliang_y) 166 | time.sleep(5) 167 | d.click(liuliang_x,liuliang_y) 168 | ''' 169 | 170 | time.sleep(5) 171 | print("get liu liang") 172 | print("JD done") 173 | 174 | 175 | def gdyd_cuizi(): 176 | d.screen.on() 177 | d.press.home() 178 | # 解锁,没有密码的情况下 179 | sx = 560 180 | sy = 1700 181 | ex = 560 182 | ey = 900 183 | # d.swipe(sx,sy,ex,ey,steps=2) 184 | 185 | # d(scrollable=True).fling.horiz.forward() 186 | home_swipe_sx = 950 187 | home_swipe_sy = 1350 188 | home_swipe_ex = 450 189 | home_swipe_ey = 1350 190 | while not d(text=u"广东移动").exists: 191 | d.swipe(home_swipe_sx, home_swipe_sy, home_swipe_ex, home_swipe_ey, steps=2) 192 | time.sleep(3) 193 | d(text=u'广东移动').click() 194 | if d(text=u'版本更新').wait.exists(timeout=12 * 1000): 195 | print("Dismiss update") 196 | d(text=u'取消').click() 197 | # 登录账号,刷新下即可 198 | s_x = 544 199 | s_y = 367 200 | e_x = 544 201 | e_y = 1438 202 | time.sleep(8) 203 | d.swipe(s_x, s_y, e_x, e_y, steps=4) 204 | 205 | while not d(text=u"签到赢话费").exists: 206 | d.swipe(home_swipe_sx, home_swipe_sy, home_swipe_ex, home_swipe_ey, steps=2) 207 | time.sleep(3) 208 | d(text=u'签到赢话费').click() 209 | time.sleep(10) 210 | yd_x = 540 211 | yd_y = 1100 212 | d.click(yd_x, yd_y) 213 | print("GDYD done") 214 | d.press.back() 215 | d(text=u'全部').click() 216 | time.sleep(8) 217 | d(text=u'零流量').click() 218 | time.sleep(8) 219 | d(text='签到') 220 | 221 | 222 | def each_dianpu(): 223 | mid_x = displayWidth / 2 224 | # d.click(919,566) 225 | time.sleep(4) 226 | 227 | d.click(mid_x, 1868) 228 | # 点击免费试用 229 | time.sleep(4) 230 | d.click(mid_x, 1311) 231 | time.sleep(4) 232 | d.click(mid_x, 1555) 233 | time.sleep(8) 234 | d.press.back() 235 | time.sleep(5) 236 | d.press.back() 237 | time.sleep(5) 238 | # 返回到试用列表 239 | 240 | 241 | def taobao_cuizi(): 242 | d.screen.on() 243 | d.press.home() 244 | 245 | activity_name = 'com.taobao.taobao/com.taobao.tao.homepage.MainActivity3' 246 | launch_app(activity_name) 247 | if d(text=u'领金币').wait.exists(timeout=12 * 1000): 248 | # print("Dismiss update") 249 | d(text=u'领金币').click() 250 | # 登录账号,刷新下即可 251 | 252 | time.sleep(15) 253 | jb_x = 900 254 | jb_y = 370 255 | d.click(jb_x, jb_y) 256 | print("Click") 257 | time.sleep(6) 258 | 259 | 260 | def taobao_shiyong(): 261 | # 一天试用 15次 262 | d.screen.on() 263 | d.press.home() 264 | 265 | activity_name = 'com.taobao.taobao/com.taobao.tao.homepage.MainActivity3' 266 | launch_app(activity_name) 267 | mid_x = displayWidth / 2 268 | time.sleep(8) 269 | d.click(980, 1863) 270 | try: 271 | 272 | time.sleep(3) 273 | d(text='查看全部工具').click() 274 | time.sleep(3) 275 | d(scrollable=True).scroll.to(text=u'免费试用') 276 | time.sleep(2) 277 | d(text=u'免费试用').click() 278 | time.sleep(8) 279 | 280 | delta_y = 144 281 | full_y = 1920 282 | full_x = 1080 283 | fix_x = 880 284 | origin_y = 222 285 | d.swipe(fix_x, full_y - delta_y, fix_x, origin_y) 286 | time.sleep(8) 287 | 288 | # 数码科技 289 | # d.click(614,1185) 290 | 291 | # 家用电器 292 | d.click(890, 1185) 293 | time.sleep(7) 294 | 295 | delta_each = 400 296 | time.sleep(3) 297 | 298 | for dragtime in range(5): 299 | for i in range(3): 300 | print("Trial") 301 | d.click(919, 600 + i * delta_each) 302 | time.sleep(8) 303 | each_dianpu() 304 | 305 | d.swipe(919, 1600, 919, 400) 306 | time.sleep(5) 307 | except: 308 | print("Can't find items") 309 | 310 | 311 | def manual_shiyong(): 312 | delta_each = 400 313 | time.sleep(3) 314 | 315 | for dragtime in range(20): 316 | print("dragtime") 317 | for i in range(3): 318 | d.click(919, 420 + i * delta_each) 319 | print('click') 320 | time.sleep(8) 321 | each_dianpu() 322 | time.sleep(8) 323 | d.swipe(919, 420 + delta_each * 3, 919, 400) 324 | time.sleep(5) 325 | 326 | 327 | def jd_jr(): 328 | # d.screen.on() 329 | # d.press.home() 330 | 331 | activity_name = 'com.jd.jrapp/.WelcomeActivity' 332 | launch_app(activity_name) 333 | time.sleep(10) 334 | 335 | ME_x = 944 336 | ME_y = 1868 337 | print("me") 338 | d.click(ME_x, ME_y) 339 | time.sleep(8) 340 | 341 | # 日历 342 | # rili_x = 677 343 | # rili_y = 809 344 | # d.click(rili_x,rili_y) 345 | # rili_item_x =560 346 | # rili_item_y = 958 347 | # 348 | # d.click(rili_item_x,rili_item_y) 349 | # time.sleep(5) 350 | # 351 | # choujian_x = 523 352 | # choujian_y = 1265 353 | # 354 | # d.click(choujian_x,choujian_y) 355 | # time.sleep(5) 356 | # 357 | # d.press.back() 358 | # time.sleep(5) 359 | # d.press.back() 360 | # time.sleep(5) 361 | 362 | QianDao_x = 126 363 | QianDao_y = 673 364 | print("qiandao") 365 | d.click(QianDao_x, QianDao_y) 366 | time.sleep(12) 367 | GangBeng_x = 867 368 | GangBeng_y = 533 369 | print("gangben") 370 | d.click(GangBeng_x, GangBeng_y) 371 | time.sleep(5) 372 | print("jd_jr done") 373 | d.press.back() 374 | time.sleep(8) 375 | # QianDao_x=131 376 | # QianDao_y=767 377 | d.click(QianDao_x, QianDao_y) 378 | time.sleep(5) 379 | 380 | # know_x=541 381 | # know_y=1273 382 | # d.click(know_x,know_y) 383 | # time.sleep(3) 384 | 385 | # time.sleep(5) 386 | GoJD_x = 955 387 | GoJD_y = 708 388 | d.click(GoJD_x, GoJD_y) 389 | time.sleep(10) 390 | 391 | Jindou_x = 860 392 | Jindou_y = 1046 393 | d.click(Jindou_x, Jindou_y) 394 | time.sleep(10) 395 | 396 | qiandao_JD_x = 878 397 | qiandao_JD_y = 429 398 | d.click(qiandao_JD_x, qiandao_JD_y) 399 | time.sleep(8) 400 | 401 | fangpai_x = 548 402 | fangpai_y = 1004 403 | d.click(fangpai_x, fangpai_y) 404 | time.sleep(5) 405 | 406 | shouru_x = 538 407 | shouru_y = 1623 408 | 409 | d.click(shouru_x, shouru_y) 410 | time.sleep(9) 411 | 412 | close_x = 939 413 | close_y = 544 414 | d.click(close_x, close_y) 415 | time.sleep(5) 416 | 417 | liuliang_x = 692 418 | liuliang_y = 997 419 | d.click(liuliang_x, liuliang_y) 420 | time.sleep(10) 421 | 422 | liuliang_qiandao_x = 537 423 | liuliang_qiandao_y = 441 424 | 425 | d.click(liuliang_qiandao_x, liuliang_qiandao_y) 426 | time.sleep(5) 427 | 428 | d.press.back() 429 | time.sleep(8) 430 | d.press.back() 431 | time.sleep(8) 432 | d.press.back() 433 | time.sleep(8) 434 | 435 | finish_x = 870 436 | finish_y = 1240 437 | d.click(finish_x, finish_y) 438 | time.sleep(3) 439 | 440 | print("JD done") 441 | 442 | 443 | def wjjf(): 444 | activity_name = 'com.hxwj.wjjf/.act.SplashActivity' 445 | launch_app(activity_name) 446 | time.sleep(15) 447 | 448 | me_x = 969 449 | me_y = 1854 450 | d.click(me_x, me_y) 451 | time.sleep(9) 452 | 453 | qiandao_x = 371 454 | qiandao_y = 414 455 | d.click(qiandao_x, qiandao_y) 456 | time.sleep(9) 457 | 458 | 459 | def fxsc(): 460 | activity_name = 'com.phicomm.fxmall/com.phicomm.fxmall.view.MainActivity' 461 | launch_app(activity_name) 462 | time.sleep(15) 463 | 464 | me_X = 1002 465 | me_Y = 1865 466 | d.click(me_X, me_Y) 467 | time.sleep(8) 468 | 469 | qiandao_X = 400 470 | qiandao_Y = 300 471 | d.click(qiandao_X, qiandao_Y) 472 | time.sleep(8) 473 | 474 | # 中国移动 475 | def cmcc(): 476 | activity_name = 'com.kingpoint.gmcchh/.newui.main.skeleton.view.SkeletonActivity' 477 | launch_app(activity_name) 478 | time.sleep(15) 479 | 480 | track_list = [(123,1865),(651,338),(520,957)] 481 | for step in track_list: 482 | d.click(step[0],step[1]) 483 | print('click') 484 | time.sleep(5) 485 | 486 | 487 | # 支付宝 488 | def alipay(): 489 | activity_name = 'com.eg.android.AlipayGphone/.AlipayLogin' 490 | launch_app(activity_name) 491 | time.sleep(10) 492 | 493 | #领取搜索红包 494 | track_list0 = [(226,163),(188,582),(455,577)] 495 | 496 | for step in track_list0: 497 | d.click(step[0],step[1]) 498 | print('click') 499 | time.sleep(5) 500 | 501 | # 点击3次返回到主页 502 | d.press('back') 503 | time.sleep(3) 504 | d.press('back') 505 | time.sleep(3) 506 | d.press('back') 507 | time.sleep(3) 508 | 509 | track_list1 = [(987,1840),(563,491),(155,983),(544,686), # 连续点击 510 | (544,686),(544,686),(544,686),(544,686),(544,686), 511 | (544,686),(544,686),(544,686),(544,686),(544,686), 512 | (544,686),(544,686)] 513 | for step in track_list1: 514 | d.click(step[0],step[1]) 515 | print('click') 516 | time.sleep(5) 517 | 518 | # 云闪付 519 | def yunsanfu(): 520 | activity_name = 'com.unionpay/.activity.UPActivityWelcome' 521 | launch_app(activity_name) 522 | time.sleep(8) 523 | 524 | track_list = [(981,1389),(541,782)] 525 | for step in track_list: 526 | d.click(step[0],step[1]) 527 | time.sleep(5) 528 | print('云闪付签到完成') 529 | 530 | # 华泰 签到 531 | def htzq(): 532 | activity_name ='com.lphtsccft/com.lphtsccft.zhangle.startup.SplashScreenActivity' 533 | launch_app(activity_name) 534 | time.sleep(8) 535 | 536 | track_list = [(979, 1855), (950, 296)] 537 | for step in track_list: 538 | d.click(step[0], step[1]) 539 | time.sleep(5) 540 | 541 | print('华泰签到完成') 542 | 543 | def other_func(): 544 | global displayWidth 545 | global displayHeight 546 | print(displayWidth) 547 | print(displayHeight) 548 | 549 | 550 | if __name__ == '__main__': 551 | # 获取基本信息 552 | get_info() 553 | 554 | yunsanfu() 555 | alipay() 556 | cmcc() 557 | htzq() 558 | 559 | -------------------------------------------------------------------------------- /jd.py: -------------------------------------------------------------------------------- 1 | #-*-coding=utf-8-*- 2 | 3 | def main(): 4 | 5 | 6 | if __name__ == '__main__': 7 | main() -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | # -*-coding=utf-8-*- 2 | from uiautomator import device as d 3 | 4 | 5 | # print d.info 6 | 7 | def QQ_red_bag(): 8 | i = 0 9 | while i < 10: 10 | d.screen.on() 11 | d(scrollable=True).scroll(steps=3) 12 | # d(textContains=u'红包').click() 13 | if d(textContains=u'红包').exists: 14 | print "Have red bag" 15 | d(textContains=u'新年快乐').click() 16 | 17 | i = i + 1 18 | 19 | 20 | def wechat(): 21 | x = 511 22 | y = 1627 23 | while 1: 24 | d.click(x, y) 25 | d.click(520, 1300) 26 | 27 | 28 | if __name__ == "__main__": 29 | QQ_red_bag() 30 | # wechat() 31 | -------------------------------------------------------------------------------- /now/main.py: -------------------------------------------------------------------------------- 1 | from uiautomator import device as d 2 | import time,sys 3 | def now(wait_time): 4 | x=943 5 | # y= 6 | y=742 7 | while wait_time>0: 8 | time.sleep(1) 9 | wait_time-=1 10 | count=100 11 | while count>0: 12 | print "Clicking......." 13 | d.click(x,y) 14 | time.sleep(0.001) 15 | count-=1 16 | 17 | def main(): 18 | m=1 19 | s=35 20 | wait_time=m*60+s+2 21 | now(wait_time) 22 | 23 | if __name__ == '__main__': 24 | print 'Start' 25 | main() -------------------------------------------------------------------------------- /sign_in.py: -------------------------------------------------------------------------------- 1 | # -*-coding=utf-8-*- 2 | import requests 3 | import json 4 | with open('setting.json') as f: 5 | data=json.load(f) 6 | def jd(): 7 | url = 'https://' \ 8 | 'vip.jd.com/common/signin.html?token=1024196992' 9 | headers = data['jd_header'] 10 | r=requests.get(url=url,headers=headers) 11 | print r.text 12 | 13 | 14 | def main(): 15 | jd() 16 | 17 | if __name__ == '__main__': 18 | main() 19 | -------------------------------------------------------------------------------- /suning/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rockyzsu/red_bag/21c9018ec3f20d26c848504b6e31d8ceda5ab811/suning/__init__.py -------------------------------------------------------------------------------- /suning/main.py: -------------------------------------------------------------------------------- 1 | # -*-coding=utf-8-*- 2 | import pickle 3 | import requests 4 | import time 5 | 6 | from selenium import webdriver 7 | import json 8 | 9 | with open('keys.json', 'r') as f: 10 | jsn = json.load(f) 11 | user = jsn.get('user') 12 | password = jsn.get('password') 13 | 14 | options = webdriver.ChromeOptions() 15 | options.add_argument('--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36') 16 | # options.add_argument('--headless') 17 | options.add_argument('--disable-gpu') 18 | browser = webdriver.Chrome(executable_path=r'C:\OneDrive\Python\selenium\chromedriver.exe',chrome_options=options) 19 | def suning(): 20 | 21 | options = webdriver.ChromeOptions() 22 | options.add_argument( 23 | '--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36') 24 | # options.add_argument('--headless') 25 | options.add_argument('--disable-gpu') 26 | browser = webdriver.Chrome(executable_path=r'C:\OneDrive\Python\selenium\chromedriver.exe', 27 | chrome_options=options) 28 | 29 | browser.implicitly_wait(60) 30 | url = 'https://passport.suning.com/ids/login' 31 | browser.get(url) 32 | # time.sleep(10) 33 | # browser.find_element_by_css_selector('a.tab-item').click() 34 | time.sleep(10) 35 | browser.find_element_by_id('pagename').click() 36 | browser.find_element_by_id('userName').send_keys(user) 37 | browser.find_element_by_id('password').send_keys(password) 38 | browser.find_element_by_id('submit').click() 39 | # browser.find_element_by_css_selector('div.login-btn').click() 40 | # time.sleep(100) 41 | # browser.find_element_by_css_selector('div.dt').click() 42 | # browser.find_element_by_css_selector('li.shortcut_btn.fore3.dorpdown').click() 43 | # browser.find_element_by_css_selector('li.shortcut_btn.fore3.dorpdown').click() 44 | time.sleep(5) 45 | # print browser.find_element_by_css_selector('dl.fore3.dd.fore3_10') 46 | # browser.find_element_by_css_selector('dl.fore3.dd.fore3_10').click() 47 | # browser.find_element_by_css_selector('a.btn-gutter').click() 48 | # time.sleep(10) 49 | # browser.find_element_by_xpath('//li[@class="fore3 dorpdown"]/div').click() 50 | # cookie = browser.get_cookies() 51 | # browser.close() 52 | # time.sleep(100) 53 | # browser.get('https://bean.jd.com/myJingBean/list') 54 | # time.sleep(10) 55 | 56 | # browser.find_elements_by_css_selector('div.dt.cw-icon')[2].click() 57 | # for i in x: 58 | # i.click() 59 | # cookie = browser.get_cookies() 60 | # print cookie 61 | # time.sleep(20) 62 | # pickle.dump(cookie, open("cookies.pkl", "wb")) 63 | # browser.get("http://www.baidu.com") 64 | # browser.find_element_by_id("kw").clear() 65 | # browser.find_element_by_id("kw").send_keys("selenium") 66 | # browser.find_element_by_id("su").click() 67 | # browser.quit() 68 | # time.sleep(20) 69 | # cookie = {} 70 | # 转换dict调用 71 | # for item in cookie: 72 | # cookie[item['name']] = item['value'] 73 | # 74 | # url = 'https://home.jd.com' 75 | # header = { 76 | # 'Host': 'home.jd.com', 77 | # 'Pragma': 'no-cache', 78 | # 'Upgrade-Insecure-Requests': '1', 79 | # 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36' 80 | # } 81 | # response = requests.get(url, headers=header, cookies=cookie) 82 | # print response.text 83 | 84 | def new_login(): 85 | signpage = "https://sign.suning.com/sign/welcome.do" # 签到页 86 | 87 | # browser = webdriver.Chrome() 88 | 89 | browser.get(signpage) 90 | 91 | try: 92 | 93 | # 切换到账户登录 94 | 95 | jumplogin = browser.find_element_by_xpath("//span[contains(text(),'账户登录')]") 96 | 97 | loginname = browser.find_element_by_id("userName") 98 | 99 | password_bt = browser.find_element_by_id("password") 100 | 101 | submit = browser.find_element_by_id("submit") 102 | 103 | jumplogin.click() 104 | 105 | # 延时等待 106 | 107 | browser.implicitly_wait(5) 108 | 109 | # loginname.send_keys() 110 | myusername = user 111 | mypassword = password 112 | loginname.send_keys(myusername) 113 | password_bt.send_keys(mypassword) 114 | 115 | submit.click() 116 | 117 | browser.implicitly_wait(5) 118 | 119 | if len(browser.find_elements_by_css_selector( 120 | "body > div.floor-vip > div.w.clearfix > div.user-welfare > div.sign-in.signed > div.title")): # 判断是否领取 121 | 122 | print("have got one") 123 | 124 | else: 125 | 126 | signsubmit = browser.find_element_by_class_name("starttip") 127 | 128 | signsubmit.click() 129 | 130 | print("successful--") 131 | 132 | except Exception, e: 133 | print e 134 | # msg = traceback.format_exc() # 方式1 135 | 136 | # print (msg) 137 | 138 | print("fail--") 139 | 140 | time.sleep(5) 141 | 142 | def check_login(): 143 | import pickle 144 | import requests 145 | 146 | cookies = pickle.load(open("cookies.pkl", "rb")) 147 | 148 | s = requests.Session() 149 | for cookie in cookies: 150 | s.cookies.set(cookie['name'], cookie['value']) 151 | response = s.get("https://www.jd.com") 152 | bodyStr = response.text 153 | print bodyStr 154 | 155 | 156 | if __name__ == '__main__': 157 | # suning() 158 | # check_login() 159 | new_login() -------------------------------------------------------------------------------- /taobao/miaobi.py: -------------------------------------------------------------------------------- 1 | # -*-coding=utf-8-*- 2 | 3 | # @Time : 2019/11/4 16:03 4 | # @File : miaobi.py 5 | 6 | from appium import webdriver 7 | from selenium.webdriver.support.ui import WebDriverWait 8 | from selenium.webdriver.support import expected_conditions as EC 9 | from selenium.webdriver.common.by import By 10 | import time 11 | 12 | 13 | class Taobao(): 14 | def __init__(self): 15 | desired_caps = { 16 | "appActivity": "com.taobao.tao.TBMainActivity", 17 | "platformName": "Android", 18 | "deviceName": "b47b38e4", 19 | "platformVersion": "5.1.1", 20 | "appPackage": "com.taobao.taobao", 21 | "noReset": True 22 | } 23 | 24 | self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps) 25 | 26 | def get_coin(self): 27 | time.sleep(3) 28 | # 进入页面 29 | self.driver.tap([(550, 1576), (1054, 1776)], 500) 30 | time.sleep(9) # 等待挺久的 31 | 32 | # 点击领取喵币按钮 33 | self.driver.tap([(905, 1707), (910, 1776)], 500) 34 | 35 | 36 | 37 | def start(self): 38 | time.sleep(5) 39 | count = 2 40 | current = 0 41 | 42 | while current < count: 43 | self.get_coin() 44 | count += 1 45 | 46 | obj = Taobao() 47 | obj.start() 48 | -------------------------------------------------------------------------------- /xeuqiu/main.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # website: http://30daydo.com 3 | # @Time : 2019/8/15 0:03 4 | # @File : main.py 5 | import json 6 | 7 | import requests 8 | 9 | 10 | def main(): 11 | headers = { 12 | "Cookie": "xq_a_token=95869b16141799b7bd195f570b3d08510ab25f97;u=1733473480", 13 | "User-Agent": "Xueqiu Android 11.27.4", 14 | "Accept-Encoding": "gzip", 15 | "Accept-Language": "en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4", 16 | "Host": "api.xueqiu.com", 17 | "Connection": "Keep-Alive", 18 | } 19 | url = 'https://api.xueqiu.com/statuses/bonus/list.json?_t=1SMARTISANeb9a1bf45876f77f6c88828c3b17b5c0.1733473480.1565799111784.1565799125926&_s=387bf0&size=20&x=0.58&user_id=1733473480' 20 | r = requests.get( 21 | url=url, 22 | headers=headers 23 | ) 24 | 25 | 26 | # 为了调试 27 | text = json.dumps(r.json(), ensure_ascii=False, indent=4) 28 | print(text) 29 | print(r.status_code) 30 | 31 | js_data = r.json() 32 | red_bag_list = js_data.get('items') 33 | result_list =[] 34 | for rb in red_bag_list: 35 | _id = rb.get('id') 36 | user_id=rb.get('user_id') 37 | created_at=rb.get('created_at') 38 | screen_name=rb.get('user',{}).get('screen_name','None') 39 | user_id=rb.get('user_id') 40 | 41 | 42 | 43 | if __name__ == '__main__': 44 | main() 45 | -------------------------------------------------------------------------------- /zhifubao/alipay_red.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | # 公众号:可转债量化分析 3 | 4 | import datetime 5 | from appium import webdriver 6 | from selenium.webdriver.support.ui import WebDriverWait 7 | from selenium.webdriver.support import expected_conditions as EC 8 | from selenium.webdriver.common.by import By 9 | import time 10 | import re 11 | import os 12 | from pathlib import PurePath 13 | import fire 14 | 15 | 16 | def delay(func): 17 | # 延时装饰器 18 | def wrapper(*args, **kwargs): 19 | result = func(*args, **kwargs) 20 | time.sleep(1) 21 | return result 22 | 23 | return wrapper 24 | 25 | 26 | class DriveBase: 27 | ''' 28 | 封装的基类 29 | ''' 30 | 31 | def __init__(self, deviceName, package, activity, resetKB): 32 | self.desired_caps = { 33 | 34 | 'platformName': 'Android', 35 | 36 | 'deviceName': deviceName, 37 | 38 | 'platformVersion': '9.0', 39 | 40 | # apk包名 41 | 42 | 'appPackage': package, 43 | 44 | # apk的launcherActivity 45 | 46 | 'appActivity': activity, 47 | 48 | 'noReset': True, 49 | 'unicodeKeyboard': True, 50 | 'resetKeyboard': resetKB, 51 | 'skipServerInstallation': True, 52 | # 'autoLaunch':False, 53 | } 54 | self.driver = webdriver.Remote( 55 | 'http://127.0.0.1:4723/wd/hub', self.desired_caps) 56 | self.wait = WebDriverWait(self.driver, 10) 57 | 58 | def start(self): 59 | raise NotImplementedError('need to instance') 60 | 61 | def root_path(self): 62 | return PurePath(__file__).parent 63 | 64 | def get_bound_center(self, points): 65 | 66 | left_top, right_bottom = points[0], points[1] 67 | centerX = (left_top[0] + right_bottom[0]) / 2 68 | centerY = (left_top[1] + right_bottom[1]) / 2 69 | return int(centerX), int(centerY) 70 | 71 | @delay 72 | def click(self, points): 73 | centerX, centerY = self.get_bound_center(points) 74 | self.driver.tap([(centerX, centerY)]) 75 | 76 | def get_screen_size(self): 77 | x = self.driver.get_window_size()['width'] # 获取屏幕宽度 78 | y = self.driver.get_window_size()['height'] # 获取屏幕高度 79 | return (x, y) 80 | 81 | @delay 82 | def swipe_scroll_vertical(self,screen=True): 83 | if screen: 84 | self.driver.swipe(500, 2000, 500, 400, 3000) 85 | else: 86 | self.driver.swipe(500, 1200, 500, 800, 3000) 87 | 88 | 89 | def read_histroy(self, filename): 90 | if not os.path.exists(filename): 91 | return [] 92 | 93 | with open(filename, 'r') as f: 94 | return [i.strip() for i in f.readlines()] 95 | 96 | def save_hitory(self, filename, result_list): 97 | content = '\n'.join(result_list) 98 | with open(filename, 'w') as f: 99 | f.write(content) 100 | 101 | def clear_file(self, filename): 102 | try: 103 | os.remove(filename) 104 | except Exception as e: 105 | print(e) 106 | 107 | 108 | class Alipay(DriveBase): 109 | def __init__(self, deviceName, package, activity, resetKB=False): 110 | super(Alipay, self).__init__(deviceName, package, activity, resetKB) 111 | self.history_file = os.path.join(self.root_path(), 'redbag.txt') 112 | self.width, self.height = self.get_screen_size() 113 | 114 | def video_redbag(self): 115 | ''' 116 | 直播红包 117 | ''' 118 | target = '16:30' 119 | # self.waiting(self.convert_datetime(target)) 120 | def found_redbag_icon(self): 121 | 122 | 123 | redbag_list = self.driver.find_elements_by_xpath('//android.widget.ImageView') 124 | 125 | def fund_redbag(self, clear, new_version): 126 | ''' 127 | 答题红包 128 | ''' 129 | 130 | if clear: 131 | self.clear_file(self.history_file) 132 | 133 | self.history_result = self.read_histroy(self.history_file) 134 | self.click_by_text('理财') 135 | time.sleep(1) 136 | delta_x = 0 137 | if new_version: 138 | delta_x = 90 139 | 140 | search_points = [819 * self.width / 1080 + delta_x, 84 * self.height / 2207], [ 141 | 963 * self.width / 1080 + delta_x, 142 | 143 | 228 * self.height / 2207] 144 | self.click(search_points) 145 | 146 | # 输入 147 | input_btn = WebDriverWait(self.driver, 4).until(EC.presence_of_element_located( 148 | (By.XPATH, '//android.widget.EditText[@text="搜索"]'))) 149 | input_btn.send_keys(u'财富号') 150 | time.sleep(1) 151 | 152 | self.click_by_text('搜索') 153 | time.sleep(1) 154 | 155 | # 向右滑动到最后 156 | self.move_right_to_end() 157 | self.click_by_text('查看更多') 158 | 159 | while True: 160 | # 出现一个列表 161 | # self.slow_method() 162 | self.found_icon() 163 | 164 | def slow_method(self): 165 | item_list = self.driver.find_elements_by_xpath( 166 | '//android.widget.TextView[contains(@text, "财富号")]') 167 | 168 | item_list = item_list[1:] 169 | 170 | 171 | for item in item_list: 172 | text = item.text 173 | # 174 | if text in self.history_result: 175 | continue 176 | 177 | if re.search('信用卡财富号|储蓄卡财富号', text): 178 | self.history_result.append(text) 179 | self.save_hitory(self.history_file, self.history_result) 180 | # self.driver.back() 181 | continue 182 | 183 | try: 184 | item.click() 185 | time.sleep(3) 186 | except Exception as e: 187 | pass 188 | else: 189 | # 基金详情页面 190 | try: 191 | self.swipe_scroll_vertical(screen=False) 192 | has_redbag = self.driver.find_element_by_xpath( 193 | '//android.view.View[@text="答题领取"]') 194 | 195 | except Exception as e: 196 | print(f'{text} ==>没有红包') 197 | self.history_result.append(text) 198 | self.save_hitory( 199 | self.history_file, self.history_result) 200 | time.sleep(1) 201 | else: 202 | self.going_redbag_page(text, has_redbag) 203 | time.sleep(1) 204 | 205 | self.driver.back() 206 | print('点击返回') 207 | 208 | time.sleep(1) 209 | 210 | # 向下滑动 211 | self.scroll_down_next_page_fund_list() 212 | 213 | def found_icon(self): 214 | ''' 215 | 根据图标更新 216 | ''' 217 | 218 | layouts = self.driver.find_elements_by_xpath('//android.widget.ListView/android.widget.FrameLayout') 219 | for layout in layouts: 220 | 221 | redbag_icon = layout.find_elements_by_xpath('.//android.widget.ImageView') 222 | if len(redbag_icon)==2: 223 | name = layout.find_element_by_xpath('.//android.widget.TextView[contains(@text, "财富号")]') 224 | text = name.text 225 | redbag_icon[1].click() 226 | time.sleep(3) 227 | 228 | try: 229 | self.swipe_scroll_vertical(screen=False) 230 | time.sleep(2) 231 | has_redbag = self.driver.find_element_by_xpath( 232 | '//android.view.View[@text="答题领取"]') 233 | 234 | except Exception as e: 235 | time.sleep(1) 236 | else: 237 | self.going_redbag_page(text, has_redbag) 238 | time.sleep(2) 239 | 240 | self.driver.back() 241 | print('点击返回') 242 | time.sleep(2) 243 | 244 | self.scroll_down_next_page_fund_list() 245 | 246 | def scroll_down_next_page_fund_list(self): 247 | time.sleep(1) 248 | self.driver.swipe(219, 1909, 219, 100, 3000) 249 | time.sleep(1) 250 | 251 | def move_right_to_end(self): 252 | self.driver.swipe(1000, 520, 200, 520, 1000) 253 | time.sleep(1) 254 | self.driver.swipe(1000, 520, 200, 520, 1000) 255 | time.sleep(1) 256 | 257 | def going_redbag_page(self, text, has_redbag): 258 | time.sleep(2) 259 | print(f'{text} ==>红包') 260 | has_redbag.click() 261 | time.sleep(2) 262 | 263 | answer_list = self.driver.find_elements_by_xpath( 264 | '//android.view.View[@clickable="true"]') 265 | found = False 266 | button_number = 0 267 | 268 | while not found and button_number < 2: 269 | 270 | try: 271 | answer_list[button_number].click() # 点击第一个答案 272 | 273 | except Exception as e: 274 | # print(e) 275 | time.sleep(1) 276 | else: 277 | 278 | if self.check_answer_right(): # 判断是否正确 279 | self.driver.back() 280 | time.sleep(1) 281 | break 282 | button_number += 1 283 | 284 | def check_answer_right(self): 285 | is_right = False 286 | 287 | try: 288 | answer_right = WebDriverWait(self.driver, 289 | 3).until(EC.presence_of_element_located((By.XPATH, 290 | f'//android.view.View[@text="恭喜获得财运红包"]'))) 291 | except: 292 | pass 293 | else: 294 | return True 295 | 296 | try: 297 | answer_right = WebDriverWait(self.driver, 298 | 3).until(EC.presence_of_element_located((By.XPATH, 299 | f'//android.view.View[@text="距离红包失效还有"]'))) 300 | except: 301 | pass 302 | else: 303 | return True 304 | 305 | return is_right 306 | 307 | @delay 308 | def click_by_text(self, text): 309 | broadcast_btn = WebDriverWait(self.driver, 3).until( 310 | EC.presence_of_element_located((By.XPATH, f'//android.widget.TextView[@text="{text}"]'))) 311 | broadcast_btn.click() 312 | 313 | def convert_datetime(self, tarret): 314 | today = datetime.date.today() 315 | return datetime.datetime.strptime(f'{today.year}-{today.month}-{today.day} ' + tarret, '%Y-%m-%d %H:%M') 316 | 317 | def waiting(self, target): 318 | 319 | # 阻塞程序 320 | while True: 321 | if datetime.datetime.now() - datetime.timedelta(seconds=5) > target: 322 | break 323 | else: 324 | time.sleep(1) 325 | 326 | 327 | def find_redbag_except_bond(self): 328 | ''' 329 | 寻找债基 330 | ''' 331 | self.click_by_text('卡包') 332 | 333 | result = set() 334 | self.swipe_scroll_vertical(screen=True) 335 | 336 | while True: 337 | 338 | redbags = self.driver.find_elements_by_xpath('//android.widget.TextView[@text="去使用"]') 339 | fund_num = len(redbags) 340 | time.sleep(1) 341 | print(f'fund_num {fund_num}') 342 | for redbag_num in range(fund_num): 343 | try: 344 | 345 | redbag_list = self.driver.find_elements_by_xpath('//android.widget.TextView[@text="去使用"]/parent::android.widget.FrameLayout/preceding-sibling::android.widget.LinearLayout') 346 | 347 | except Exception as e: 348 | continue 349 | 350 | if len(redbag_list) - 1 < redbag_num: 351 | break 352 | 353 | redbag_list[redbag_num].click() 354 | time.sleep(2) 355 | 356 | try: 357 | name = self.driver.find_element_by_xpath('//android.widget.TextView[contains(@text, "财富号")]') 358 | except Exception as e: 359 | time.sleep(1) 360 | self.driver.back() 361 | time.sleep(1) 362 | # print('return back') 363 | continue 364 | 365 | try: 366 | is_bond = self.driver.find_element_by_xpath( 367 | '//android.widget.TextView[contains(@text, "债") or contains(@text, "理财") or contains(@text, "货币") or contains(@text, "所有")]') 368 | except Exception as e: 369 | # self.driver.find_element_by_xpath('//') 370 | delete_img = [972, 84], [1044, 228] 371 | self.click(delete_img) 372 | delete_name = self.driver.find_element_by_xpath('//android.widget.TextView[@text="删除"]') 373 | delete_name.click() 374 | time.sleep(2) 375 | delete_btn = self.driver.find_element_by_xpath('//android.widget.Button[@text="确定"]') 376 | delete_btn.click() 377 | time.sleep(2) 378 | 379 | else: 380 | print(f'{name.text} 可用标的债/货币: \n{is_bond.text}\n') 381 | result.add(name.text) 382 | self.driver.back() 383 | time.sleep(1) 384 | 385 | self.swipe_scroll_vertical(screen=True) 386 | self.save_hitory('used_bond.txt', list(result)) 387 | 388 | 389 | z3 = 'cf828af' 390 | z1 = 'ab7cded6' 391 | 392 | 393 | def alipy_fund_redbag(clear=False, resetKB=False, search=True, new_version=False, device='z3'): 394 | '''阿里云红包''' 395 | 396 | package = 'com.eg.android.AlipayGphone' 397 | activity = 'com.eg.android.AlipayGphone.AlipayLogin' 398 | 399 | # if device=='z1': 400 | deviceName = device 401 | # deviceName = z1 402 | 403 | app = Alipay(deviceName, package, activity, resetKB) 404 | if search: 405 | app.fund_redbag(clear, new_version) 406 | else: 407 | app.find_redbag_except_bond() 408 | 409 | 410 | if __name__ == '__main__': 411 | fire.Fire(alipy_fund_redbag) 412 | --------------------------------------------------------------------------------