├── .gitattributes ├── .gitignore ├── 3.csv ├── JDPackage ├── __init__.py ├── account.py ├── coupon.py ├── datacontrol.py ├── lotterypack.py ├── mlogin.py ├── mloginPYV8.py ├── rk.py ├── spider.py └── spider.pyc ├── [单线程]领卷模式1示例.py ├── [多线程]领卷模式1示例.py ├── cookies.csv ├── readme.md ├── 循环测水示例.py ├── 批量抽奖预约.py ├── 批量评价示例.py ├── 抽奖代码爬虫示例.py ├── 抽奖实例(不带代理).py ├── 抽奖实例(带代理).py ├── 浏览器载入Cookies.py ├── 账户信息查询.py ├── 遍历所有抽奖代码抽奖.py └── 领取a.jd.com优惠券示例.py /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | 5 | # C extensions 6 | *.so 7 | 8 | # Distribution / packaging 9 | .Python 10 | env/ 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | lib/ 17 | lib64/ 18 | parts/ 19 | sdist/ 20 | var/ 21 | *.egg-info/ 22 | .installed.cfg 23 | *.egg 24 | 25 | # PyInstaller 26 | # Usually these files are written by a python script from a template 27 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 28 | *.manifest 29 | *.spec 30 | 31 | # Installer logs 32 | pip-log.txt 33 | pip-delete-this-directory.txt 34 | 35 | # Unit test / coverage reports 36 | htmlcov/ 37 | .tox/ 38 | .coverage 39 | .cache 40 | nosetests.xml 41 | coverage.xml 42 | 43 | # Translations 44 | *.mo 45 | *.pot 46 | 47 | # Django stuff: 48 | *.log 49 | 50 | # Sphinx documentation 51 | docs/_build/ 52 | 53 | # PyBuilder 54 | target/ 55 | 56 | # ========================= 57 | # Operating System Files 58 | # ========================= 59 | 60 | # OSX 61 | # ========================= 62 | 63 | .DS_Store 64 | .AppleDouble 65 | .LSOverride 66 | 67 | # Thumbnails 68 | ._* 69 | 70 | # Files that might appear on external disk 71 | .Spotlight-V100 72 | .Trashes 73 | 74 | # Directories potentially created on remote AFP share 75 | .AppleDB 76 | .AppleDesktop 77 | Network Trash Folder 78 | Temporary Items 79 | .apdisk 80 | 81 | # Windows 82 | # ========================= 83 | 84 | # Windows image file caches 85 | Thumbs.db 86 | ehthumbs.db 87 | 88 | # Folder config file 89 | Desktop.ini 90 | 91 | # Recycle Bin used on file shares 92 | $RECYCLE.BIN/ 93 | 94 | # Windows Installer files 95 | *.cab 96 | *.msi 97 | *.msm 98 | *.msp 99 | 100 | # Windows shortcuts 101 | *.lnk 102 | -------------------------------------------------------------------------------- /3.csv: -------------------------------------------------------------------------------- 1 | "url" 2 | "http://zy3songshu.jd.com/" 3 | "http://zan.jd.com/" 4 | "http://z.jd.com/" 5 | "http://yumacp.jd.com/" 6 | "http://yiyao.jd.com/" 7 | "http://yingxiang.jd.com/" 8 | "http://yangshengtangyybj.jd.com/" 9 | "http://xuan.jd.com/" 10 | "http://xjk.jr.jd.com/" 11 | "http://xinren.jd.com/" 12 | "http://xinpin.jd.com/" 13 | "http://xihuan.jd.com/" 14 | "http://xdfdy.jd.com/" 15 | "http://www.jd.hk/"" target=""_blank"">全球购 16 | 17 |
  • 64 | 钱包>
    京东钱包
    " 96 | "http://jdpay.com" 97 | "http://jdd.jr.jd.com/" 98 | "http://itsy.jd.com/" 99 | "http://item.yiya.jd.com/" 100 | "http://item.jd.com/" 101 | "http://isheji.jd.com/" 102 | "http://img14.360buyimg.com/da/jfs/t256/349/769670066/270505/3b03e0bb/53f16c24N7c04d9e9.jpg"" target=""" 103 | "http://ijipiao.jd.com/" 104 | "http://ihome.jd.com/" 105 | "http://https://sale.jd.com/" 106 | "http://https://moengf.jd.com/" 107 | "http://https://ctf.jd.com/" 108 | "http://hotel.jd.com/" 109 | "http://home.jd.com/" 110 | "http://henkel.jd.com/" 111 | "http://health.jd.com/" 112 | "http://harborhouse.jd.com/" 113 | "http://hao.jd.com/" 114 | "http://handas.jd.com/" 115 | "http://haimaauto.jd.com/" 116 | "http://haier.jd.com/" 117 | "http://guylaroche.jd.com/" 118 | "http://group.jd.com/" 119 | "http://gongyi.jd.com/" 120 | "http://gjzhubao.jd.com/" 121 | "http://giftcard.jd.com/" 122 | "http://gb.jd.com/" 123 | "http://gaming.jd.com/" 124 | "http://game.jd.com/" 125 | "http://fuwu.jd.com/" 126 | "http://fund.jd.com/" 127 | "http://fresh.jd.com/" 128 | "http://fang.jd.com/" 129 | "http://en.jd.com/" 130 | "http://edifier.jd.com/" 131 | "http://e.jd.com/" 132 | "http://dujia.jd.com/" 133 | "http://dq.jd.com/" 134 | "http://dj.jd.com/" 135 | "http://diy.jd.com/" 136 | "http://diannao.jd.com/" 137 | "http://dell.jd.com/" 138 | "http://deli.jd.com/" 139 | "http://ct.jd.com/" 140 | "http://credit.jd.com/" 141 | "http://converse.jd.com/" 142 | "http://columbia.jd.com/" 143 | "http://coll.jd.com/" 144 | "http://club.jd.com/" 145 | "http://chuwei.jd.com/" 146 | "http://chongzhi.jd.com/" 147 | "http://china.jd.com/" 148 | "http://che.jd.com/" 149 | "http://chaoshi.jd.com/" 150 | "http://channel.jd.com/yunyingshang.html" 151 | "http://channel.jd.com/yundongcheng.html" 152 | "http://channel.jd.com/yundong.html" 153 | "http://channel.jd.com/womensshoes.html" 154 | "http://channel.jd.com/womensbag.html" 155 | "http://channel.jd.com/women.html" 156 | "http://channel.jd.com/wine.html" 157 | "http://channel.jd.com/watch.html" 158 | "http://channel.jd.com/underwear.html" 159 | "http://channel.jd.com/toys.html" 160 | "http://channel.jd.com/telecom.html" 161 | "http://channel.jd.com/sports.html" 162 | "http://channel.jd.com/shoes.html" 163 | "http://channel.jd.com/p_zhexuezongjiao.html" 164 | "http://channel.jd.com/p_wenxuezongheguan.html" 165 | "http://channel.jd.com/p_guoxueguji.html" 166 | "http://channel.jd.com/p_Comprehensive.html" 167 | "http://channel.jd.com/pet.html" 168 | "http://channel.jd.com/peijiancheng.html" 169 | "http://channel.jd.com/peijian.html" 170 | "http://channel.jd.com/outdoor.html" 171 | "http://channel.jd.com/mushouchuan.html" 172 | "http://channel.jd.com/mensshoes.html" 173 | "http://channel.jd.com/mensbag.html" 174 | "http://channel.jd.com/men.html" 175 | "http://channel.jd.com/luxury.html" 176 | "http://channel.jd.com/kitchenware.html" 177 | "http://channel.jd.com/jintiao.html" 178 | "http://channel.jd.com/jiazhuang.html" 179 | "http://channel.jd.com/jewellery.html" 180 | "http://channel.jd.com/huangjin.html" 181 | "http://channel.jd.com/home.html" 182 | "http://channel.jd.com/health.html" 183 | "http://channel.jd.com/furniture.html" 184 | "http://channel.jd.com/freshfood.html" 185 | "http://channel.jd.com/food.html" 186 | "http://channel.jd.com/fashion.html" 187 | "http://channel.jd.com/electronic.html" 188 | "http://channel.jd.com/dingzhijia.html" 189 | "http://channel.jd.com/decoration.html" 190 | "http://channel.jd.com/children.html" 191 | "http://channel.jd.com/beautysale.html" 192 | "http://channel.jd.com/beauty.html" 193 | "http://channel.jd.com/bag.html" 194 | "http://channel.jd.com/auto.html" 195 | "http://channel.jd.com/9855-9862.html" 196 | "http://channel.jd.com/9855-9861.html" 197 | "http://channel.jd.com/9855-9860.html" 198 | "http://channel.jd.com/9855-9859.html" 199 | "http://channel.jd.com/9855-9858.html" 200 | "http://channel.jd.com/9855-9857.html" 201 | "http://channel.jd.com/9855-9856.html" 202 | "http://channel.jd.com/9847-9854.html" 203 | "http://channel.jd.com/9847-9853.html" 204 | "http://channel.jd.com/9847-9852.html" 205 | "http://channel.jd.com/9847-9851.html" 206 | "http://channel.jd.com/9847-9850.html" 207 | "http://channel.jd.com/9847-9849.html" 208 | "http://channel.jd.com/9847-9848.html" 209 | "http://channel.jd.com/9192-9197.html" 210 | "http://channel.jd.com/9192-9196.html" 211 | "http://channel.jd.com/9192-9195.html" 212 | "http://channel.jd.com/9192-9194.html" 213 | "http://channel.jd.com/9192-9193.html" 214 | "http://channel.jd.com/9192-12190.html" 215 | "http://channel.jd.com/737-752.html" 216 | "http://channel.jd.com/737-738.html" 217 | "http://channel.jd.com/737-1276.html" 218 | "http://channel.jd.com/6994-7001.html" 219 | "http://channel.jd.com/6994-7000.html" 220 | "http://channel.jd.com/6994-6999.html" 221 | "http://channel.jd.com/6994-6998.html" 222 | "http://channel.jd.com/6994-6997.html" 223 | "http://channel.jd.com/6994-6996.html" 224 | "http://channel.jd.com/6994-6995.html" 225 | "http://channel.jd.com/6728-6747.html" 226 | "http://channel.jd.com/6728-6745.html" 227 | "http://channel.jd.com/6728-6743.html" 228 | "http://channel.jd.com/6728-6742.html" 229 | "http://channel.jd.com/6728-6740.html" 230 | "http://channel.jd.com/6728-13256.html" 231 | "http://channel.jd.com/6728-12402.html" 232 | "http://channel.jd.com/670-729.html" 233 | "http://channel.jd.com/670-716.html" 234 | "http://channel.jd.com/670-703.html" 235 | "http://channel.jd.com/670-699.html" 236 | "http://channel.jd.com/670-686.html" 237 | "http://channel.jd.com/670-677.html" 238 | "http://channel.jd.com/670-671.html" 239 | "http://channel.jd.com/670-12800.html" 240 | "http://channel.jd.com/652-828.html" 241 | "http://channel.jd.com/652-654.html" 242 | "http://channel.jd.com/652-12346.html" 243 | "http://channel.jd.com/652-12345.html" 244 | "http://channel.jd.com/6233-6291.html" 245 | "http://channel.jd.com/6233-6289.html" 246 | "http://channel.jd.com/6233-6279.html" 247 | "http://channel.jd.com/6233-6275.html" 248 | "http://channel.jd.com/6233-6271.html" 249 | "http://channel.jd.com/6233-6264.html" 250 | "http://channel.jd.com/6233-6260.html" 251 | "http://channel.jd.com/6233-6253.html" 252 | "http://channel.jd.com/6233-6237.html" 253 | "http://channel.jd.com/6233-6236.html" 254 | "http://channel.jd.com/6233-6235.html" 255 | "http://channel.jd.com/6233-6234.html" 256 | "http://channel.jd.com/6196-6227.html" 257 | "http://channel.jd.com/6196-6219.html" 258 | "http://channel.jd.com/6196-6214.html" 259 | "http://channel.jd.com/6196-6198.html" 260 | "http://channel.jd.com/6196-6197.html" 261 | "http://channel.jd.com/6196-11143.html" 262 | "http://channel.jd.com/6144-6182.html" 263 | "http://channel.jd.com/6144-6174.html" 264 | "http://channel.jd.com/6144-6172.html" 265 | "http://channel.jd.com/6144-6167.html" 266 | "http://channel.jd.com/6144-6160.html" 267 | "http://channel.jd.com/6144-6155.html" 268 | "http://channel.jd.com/6144-13062.html" 269 | "http://channel.jd.com/6144-12042.html" 270 | "http://channel.jd.com/6144-12040.html" 271 | "http://channel.jd.com/4938-12316.html" 272 | "http://channel.jd.com/4938-12300.html" 273 | "http://channel.jd.com/1713-9368.html" 274 | "http://channel.jd.com/1713-9351.html" 275 | "http://channel.jd.com/1713-9309.html" 276 | "http://channel.jd.com/1713-9301.html" 277 | "http://channel.jd.com/1713-9291.html" 278 | "http://channel.jd.com/1713-9278.html" 279 | "http://channel.jd.com/1713-6929.html" 280 | "http://channel.jd.com/1713-4855.html" 281 | "http://channel.jd.com/1713-4758.html" 282 | "http://channel.jd.com/1713-3294.html" 283 | "http://channel.jd.com/1713-3291.html" 284 | "http://channel.jd.com/1713-3290.html" 285 | "http://channel.jd.com/1713-3289.html" 286 | "http://channel.jd.com/1713-3288.html" 287 | "http://channel.jd.com/1713-3287.html" 288 | "http://channel.jd.com/1713-3286.html" 289 | "http://channel.jd.com/1713-3285.html" 290 | "http://channel.jd.com/1713-3284.html" 291 | "http://channel.jd.com/1713-3282.html" 292 | "http://channel.jd.com/1713-3281.html" 293 | "http://channel.jd.com/1713-3280.html" 294 | "http://channel.jd.com/1713-3279.html" 295 | "http://channel.jd.com/1713-3277.html" 296 | "http://channel.jd.com/1713-3276.html" 297 | "http://channel.jd.com/1713-3273.html" 298 | "http://channel.jd.com/1713-3272.html" 299 | "http://channel.jd.com/1713-3271.html" 300 | "http://channel.jd.com/1713-3270.html" 301 | "http://channel.jd.com/1713-3269.html" 302 | "http://channel.jd.com/1713-3267.html" 303 | "http://channel.jd.com/1713-3266.html" 304 | "http://channel.jd.com/1713-3265.html" 305 | "http://channel.jd.com/1713-3264.html" 306 | "http://channel.jd.com/1713-3262.html" 307 | "http://channel.jd.com/1713-3261.html" 308 | "http://channel.jd.com/1713-3260.html" 309 | "http://channel.jd.com/1713-3259.html" 310 | "http://channel.jd.com/1713-3258.html" 311 | "http://channel.jd.com/1713-12776.html" 312 | "http://channel.jd.com/1713-11047.html" 313 | "http://channel.jd.com/1672-2615.html" 314 | "http://channel.jd.com/1672-2599.html" 315 | "http://channel.jd.com/1672-2577.html" 316 | "http://channel.jd.com/1672-2576.html" 317 | "http://channel.jd.com/1672-2575.html" 318 | "http://channel.jd.com/1620-1625.html" 319 | "http://channel.jd.com/1620-1624.html" 320 | "http://channel.jd.com/1620-1623.html" 321 | "http://channel.jd.com/1620-1621.html" 322 | "http://channel.jd.com/1620-11158.html" 323 | "http://channel.jd.com/1320-5019.html" 324 | "http://channel.jd.com/1320-1585.html" 325 | "http://channel.jd.com/1320-1584.html" 326 | "http://channel.jd.com/1320-1583.html" 327 | "http://channel.jd.com/1320-12202.html" 328 | "http://channel.jd.com/1319-6313.html" 329 | "http://channel.jd.com/1319-4997.html" 330 | "http://channel.jd.com/1319-1528.html" 331 | "http://channel.jd.com/1319-1527.html" 332 | "http://channel.jd.com/1319-1526.html" 333 | "http://channel.jd.com/1319-1525.html" 334 | "http://channel.jd.com/1319-1524.html" 335 | "http://channel.jd.com/1319-1523.html" 336 | "http://channel.jd.com/1319-11842.html" 337 | "http://channel.jd.com/1318-2628.html" 338 | "http://channel.jd.com/1318-1466.html" 339 | "http://channel.jd.com/1318-1463.html" 340 | "http://channel.jd.com/1318-1462.html" 341 | "http://channel.jd.com/1318-12154.html" 342 | "http://channel.jd.com/1318-12147.html" 343 | "http://channel.jd.com/1318-12115.html" 344 | "http://channel.jd.com/1318-12102.html" 345 | "http://channel.jd.com/1316-1387.html" 346 | "http://channel.jd.com/1316-1386.html" 347 | "http://channel.jd.com/1316-1385.html" 348 | "http://channel.jd.com/1316-1384.html" 349 | "http://channel.jd.com/1316-1383.html" 350 | "http://channel.jd.com/1316-1381.html" 351 | "http://channel.jd.com/1315-1346.html" 352 | "http://channel.jd.com/1315-1345.html" 353 | "http://channel.jd.com/1315-1343.html" 354 | "http://channel.jd.com/1315-1342.html" 355 | "http://channel.jd.com/11729-11731.html" 356 | "http://channel.jd.com/11729-11730.html" 357 | "http://channel.jd.com/" 358 | "http://cfx.jd.com/" 359 | "http://cart.jd.com/" 360 | "http://card.jd.com/" 361 | "http://caipiao.jd.com/" 362 | "http://c-nfa.jd.com/" 363 | "http://brand.jd.com/" 364 | "http://book.jd.com/" 365 | "http://bk.jd.com/" 366 | "http://bill.jr.jd.com/" 367 | "http://bgyhotel.jd.com/" 368 | "http://belle.jd.com/" 369 | "http://beauty.jd.com/" 370 | "http://bao.jd.com/" 371 | "http://bangong.jd.com/" 372 | "http://balabala.jd.com/" 373 | "http://baitiao.jd.com/" 374 | "http://baina.jd.com/" 375 | "http://baby.jd.com/" 376 | "http://b.jd.com/" 377 | "http://autobeta.jd.com/" 378 | "http://auto.jd.com/" 379 | "http://apple.jd.com/" 380 | "http://app.jd.com/" 381 | "http://a.jd.com/" 382 | "http://3c.jd.com/" 383 | "http://360smart.jd.com/" 384 | "http://21cccc.jd.com/" 385 | "http://10086.jd.com/" 386 | "http://1.jd.com/" -------------------------------------------------------------------------------- /JDPackage/__init__.py: -------------------------------------------------------------------------------- 1 | from .account import * 2 | from .coupon import * 3 | from .datacontrol import * 4 | from .lotterypack import * 5 | from .mlogin import * 6 | from .rk import * 7 | from .spider import * 8 | import os 9 | try: 10 | os.mkdir('c:/temp') 11 | except: 12 | pass 13 | print ("Jingdong Tool Package Module Loaded!") 14 | print ("Author: HiddenStrawberry") 15 | -------------------------------------------------------------------------------- /JDPackage/account.py: -------------------------------------------------------------------------------- 1 | # encoding=utf-8 2 | from __future__ import print_function 3 | from .rk import * 4 | from .mlogin import * 5 | from .datacontrol import * 6 | import time 7 | import re 8 | from selenium import webdriver 9 | from selenium.webdriver.common.desired_capabilities import DesiredCapabilities 10 | 11 | dcap = dict(DesiredCapabilities.PHANTOMJS) 12 | dcap["phantomjs.page.settings.userAgent"] = ( 13 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:25.0) Gecko/20100101 Firefox/25.0 " 14 | ) 15 | 16 | 17 | class Account: 18 | def __init__(self, username, pwd, rk_um, rk_pw): 19 | self.username = username 20 | self.pwd = pwd 21 | self.rc = RClient(rk_um, rk_pw) 22 | self.rk_um = rk_um 23 | self.rk_pw = rk_pw 24 | self.ck = '' 25 | self.ck_pc = '' 26 | self.ck_browser = '' 27 | self.ck_pc_browser = '' 28 | self.session = requests.session() 29 | 30 | def login(self): 31 | # 2017/04/27 JDMLogin Cracked 32 | print(self.username, end=' ') 33 | st = True 34 | while st == True: 35 | self.ck = login(self.username, self.pwd, self.rk_um, self.rk_pw) 36 | st = False 37 | return self.ck 38 | 39 | 40 | def login_pc(self): 41 | # 2017/04/27 JDLogin HTML Version Updated 42 | 43 | rdname = str(random.randint(1000000, 10000000)) 44 | t = requests.session() 45 | cookiestr = '' 46 | headers = { 47 | 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) ' 48 | 'Chrome/54.0.2840.59 Safari/537.36 115Browser/8.0.0', 49 | 'Accept': 'application / json' 50 | } 51 | headers2={'Accept': 'image/webp,image/*,*/*;q=0.8'} 52 | html = t.get('http://passport.jd.com/new/login.aspx?ReturnUrl=https%3A%2F%2Fwww.jd.com%2F', 53 | headers=headers, verify=False).text 54 | uuid = re.findall('name="uuid" value="(.*?)"', html, re.S)[0] 55 | if 'JD_Verification' in html: 56 | yys = time.time() * 1000 57 | url = 'http://authcode.jd.com/verify/image?a=1&acid='+uuid+'&uid='+uuid+'&yys='+str(int(yys)) 58 | print (url) 59 | ir = t.get(url, headers=headers2,verify=False) 60 | save_img('C:\\temp\\' + rdname + '.png', ir) 61 | authcode = fuck_code_rk(self.rk_um, self.rk_pw, 'C:\\temp\\' + rdname + '.png') 62 | else: 63 | authcode = '' 64 | pubkey = re.findall('id="pubKey" value="(.*?)"', html, re.S)[0] 65 | 66 | 67 | data = {'uuid': re.findall('name="uuid" value="(.*?)"', html, re.S)[0], 68 | '_t': re.findall('id="token" value="(.*?)"', html, re.S)[0], 69 | 'loginType': 'c', 70 | 'loginname': self.username, 71 | 'nloginpwd': self.pwd, 72 | 'chkRememberMe': '', 73 | 'authcode': authcode, 74 | 'pubKey': pubkey, 75 | 'sa_token': re.findall('name="sa_token" value="(.*?)"', html, re.S)[0], 76 | 'seqSid': '9' 77 | } 78 | post_url="https://passport.jd.com/uc/loginService?uuid="+uuid+"&ReturnUrl=https%3A%2F%2Fwww.jd.com%2F&r=0.6866403083063548&version=2015" 79 | print (post_url) 80 | post_data = t.post( 81 | post_url, 82 | data=data, headers=headers, verify=False).text 83 | if 'success' in post_data: 84 | print(self.username, decoder('PC端登陆成功!')) 85 | else: 86 | print(post_data) 87 | raise Exception('Login Failed!') 88 | for k, value in t.cookies.items(): 89 | cookiestr = cookiestr + k + '=' + value + ';' 90 | self.ck_pc = cookiestr[:-1] 91 | return self.ck_pc 92 | 93 | def get_payment(self): 94 | payment_list = [] 95 | headers = {'cookie': self.ck_pc} 96 | html = self.session.get('http://order.jd.com/center/list.action', headers=headers, verify=False).text 97 | payment = re.findall('(.*?)
    ', html, re.S) 98 | for each in payment: 99 | try: 100 | print('===================================') 101 | add = re.findall('
    (.*?)
    ', each, re.S)[0] 102 | sku = re.findall('data-sku="(.*?)"', each, re.S)[0] 103 | itemname = re.findall('(.*?)', 104 | self.session.get('http://item.jd.com/' + str(sku) + '.html').text, re.S)[0] 105 | 106 | orderid = re.findall('id="track(.*?)"', each, re.S)[0] 107 | name = re.findall('(.*?)', add, re.S)[0] 108 | address = re.findall('

    (.*?)

    ', add, re.S)[0] 109 | phone = re.findall('

    (.*?)

    ', add, re.S)[1] 110 | print(itemname) 111 | print(orderid, name, address, phone) 112 | print('===================================') 113 | payment_list.append({'orderID': orderid, 114 | 'name': name, 115 | 'address': address, 116 | 'phone': phone, 117 | 'item': itemname, 118 | 'sku': sku}) 119 | except: 120 | pass 121 | return payment_list 122 | 123 | def get_msglist(self): 124 | msglist = [] 125 | headers = {'cookie': self.ck_pc} 126 | html = re.findall('
    (.*?)
      ', html, re.S) 142 | for each in everycoupon: 143 | # print each 144 | label = re.findall('(.*?)', each, re.S)[0] 145 | limit = re.findall('(.*?)', each, re.S)[1] 146 | couponnum = re.findall('(.*?)', each, re.S)[2] 147 | climit = re.findall('(.*?)', each, re.S)[0] 148 | price = re.findall('(.*?)', each, re.S)[0] 149 | try: 150 | price_limit = re.findall(decoder('满') + '(.*?)' + decoder('可用'), each, re.S)[0] 151 | except: 152 | price_limit = price 153 | couponlist.append({'label': label, 154 | 'limit': limit, 155 | 'couponnum': couponnum, 156 | 'climit': climit, 157 | 'price': price, 158 | 'price_limit': price_limit}) 159 | print(couponnum, label, limit, climit, decoder('满'), price_limit, decoder('元可用'), price) 160 | return couponlist 161 | 162 | def write_cookies(self, userid): 163 | data = [] 164 | if self.ck_pc == '': 165 | self.login_pc() 166 | else: 167 | for each in loadCSVfile('cookies.csv'): 168 | data.append(each) 169 | data.append([str(userid), self.ck_pc, self.username, self.pwd, self.ck_pc_browser]) 170 | writeCSVfile('cookies.csv', data) 171 | 172 | def browser(self, url, cookies=None): 173 | 174 | try: 175 | cookies = cookies.replace('==', '%%') 176 | cookies = '{\'' + (cookies.replace('=', '\':\'')).replace(';', '\',\'') + '\'}' 177 | cookies = cookies.replace('%%', '==') 178 | cookies = eval(str(cookies)) 179 | print(cookies) 180 | driver = webdriver.PhantomJS() 181 | driver.get(url) 182 | driver.delete_all_cookies() 183 | time.sleep(2) 184 | for k, value in cookies.items(): 185 | driver.add_cookie( 186 | {'domain': '.jd.com', 187 | 'name': k, 188 | 'value': value, 189 | 'path': '/', 'expires': None}) 190 | driver.get('http://club.jd.com') 191 | except Exception as err: 192 | print(err) 193 | return driver 194 | 195 | def comment(self): 196 | while True: 197 | html = requests.get('https://club.jd.com/myJdcomments/myJdcomment.action', 198 | headers={'Cookie': self.ck_pc}, verify=False).text 199 | if decoder('没有要评价的订单') in html: 200 | print(decoder('没有要评价的订单')) 201 | raise Exception('Error!') 202 | tbody = re.findall('(.*?)', html, re.S) 203 | print(decoder('浏览器加载中,请稍候……')) 204 | driver = self.browser('http://club.jd.com', cookies=self.ck_pc) 205 | for each in tbody: 206 | try: 207 | orderid = re.findall('orderid=(.*?)&', each, re.S)[0] 208 | print(orderid) 209 | itemid = re.findall('
      (.*?)
      ', each, re.S) 210 | for each_item in itemid: 211 | productId = re.findall('item.jd.com/(.*?)\.html', each_item, re.S)[0] 212 | _data = {'orderId': orderid, 213 | 'productId': productId, 214 | 'score': '5', 215 | 'tag': '%5B%5B%2220078%22%2C%22%E8%BF%98%E4%B8%8D%E9%94%99%22%5D%5D', 216 | 'saveStatus': '1', 217 | 'anonymousFlag': '1', 218 | 'content': '%E8%BF%98%E4%B8%8D%E9%94%99%E5%90%A7%E8%BF%98%E4%B8%8D%E9%94%99%E5%90%A7%E8%BF%98%E4%B8%8D%E9%94%99%E5%90%A7%E8%BF%98%E4%B8%8D%E9%94%99%E5%90%A7%E8%BF%98%E4%B8%8D%E9%94%99%E5%90%A7%E8%BF%98%E4%B8%8D%E9%94%99%E5%90%A7'} 219 | result = requests.post('https://club.jd.com/myJdcomments/saveProductComment.action', 220 | data=_data, 221 | headers={'Cookie': self.ck_pc, 222 | 'Referer': 'https://club.jd.com/myJdcomments/orderVoucher.action' 223 | '?ruleid=' + orderid, 224 | 'Accept': 'application/json, text/javascript, */*; q=0.01', 225 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) ' 226 | 'AppleWebKit/537.36 (KHTML, like Gecko) ' 227 | 'Chrome/56.0.2924.87 Safari/537.36', 228 | 'Accept-Language': 'zh-CN,zh;q=0.8', 229 | 'Accept-Encoding': 'gzip, deflate, br', 230 | 'X-Requested-With': 'XMLHttpRequest'}, 231 | verify=False).text 232 | if '"resultCode":"2"' in result: 233 | print(decoder('服务评价中……')) 234 | else: 235 | print(result) 236 | 237 | driver.get( 238 | 'http://club.jd.com/myJdcomments/orderVoucher.action?ruleid=' + orderid + '&operation=survey') 239 | time.sleep(2) 240 | try: 241 | for x in range(1, 10): 242 | driver.find_element_by_xpath('//*[@id="activityVoucher"]/div[2]/div[1]/div[1]/div[' + str( 243 | x) + ']/span[2]/span[5]').click() 244 | except Exception as Err: 245 | driver.find_element_by_xpath('//*[@id="container"]/div/div/div[2]/div[2]/a').click() 246 | time.sleep(2) 247 | print(re.findall('

      (.*?)

      ', driver.page_source, re.S)[0]) 248 | except: 249 | pass 250 | driver.quit() 251 | 252 | 253 | def set_cookies(c): 254 | c = str(c).replace("u'", "'") 255 | c = c.replace(".www", "www") 256 | c = c.replace("'.jd", "'jd") 257 | return c 258 | 259 | 260 | def lottery_login(a, b, c, d, userid): 261 | a = Account(a, b, c, d) 262 | a.login_pc() 263 | a.write_cookies(userid) 264 | 265 | 266 | def browser(url, cookies=None, cookie_dictionary=None): 267 | # try: 268 | if cookies: 269 | cookies = cookies.replace('==', '%%') 270 | cookies = '{\'' + (cookies.replace('=', '\':\'')).replace(';', '\',\'') + '\'}' 271 | cookies = cookies.replace('%%', '==') 272 | cookies = eval(str(cookies)) 273 | driver = webdriver.Firefox() 274 | driver.get(url) 275 | driver.delete_all_cookies() 276 | time.sleep(5) 277 | for k, value in cookies.items(): 278 | driver.add_cookie( 279 | {'domain': '.jd.com', 280 | 'name': k, 281 | 'value': value, 282 | 'path': '/', 'expires': None}) 283 | driver.get(url) 284 | if cookie_dictionary: 285 | driver = webdriver.Firefox() 286 | driver.get(url) 287 | driver.delete_all_cookies() 288 | time.sleep(5) 289 | for item in cookie_dictionary: 290 | driver.add_cookie( 291 | {'domain': '.jd.com', 292 | 'name': item['name'], 293 | 'value': item['value'], 294 | 'path': '/', 'expires': None}) 295 | driver.get(url) 296 | -------------------------------------------------------------------------------- /JDPackage/coupon.py: -------------------------------------------------------------------------------- 1 | # encoding=utf-8 2 | from __future__ import print_function 3 | from .account import * 4 | from .mlogin import * 5 | import datetime 6 | import random 7 | import threading 8 | import warnings 9 | import re 10 | 11 | warnings.filterwarnings("ignore") 12 | times = 0 13 | 14 | 15 | class Coupon(Account): 16 | def __init__(self, username, pwd, rk_um, rk_pw): 17 | Account.__init__(self, username, pwd, rk_um, rk_pw) 18 | 19 | def coupon_modeA(self, url_coupon, start, end,delay): 20 | url_filter = 'http://coupon.m.jd.com/coupons/show.action?key=' + re.findall('key=(.*?)&', url_coupon, re.S)[ 21 | 0] + '&roleId=' + re.findall('roleId=(.*?)&', url_coupon, re.S)[0] + '&to=m.jd.com' 22 | print (url_filter) 23 | start = datetime.datetime.strptime(start, '%Y-%m-%d %H:%M:%S') 24 | end = datetime.datetime.strptime(end, '%Y-%m-%d %H:%M:%S') 25 | threading.Thread(target=self.get_coupon_a, args=(url_filter, start, end,delay,)).start() 26 | 27 | def coupon(self, url): 28 | global times 29 | if self.ck != '': 30 | headers = {'Cookie': self.ck, 'Referer': url, 31 | 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) ' 32 | 'Chrome/54.0.2840.59 Safari/537.36 115Browser/8.0.0', 33 | 'Accept': 'text/html,application/xhtml+xml, application/xml;q=0.9,*/*;q=0.8'} 34 | rdname = str(random.randint(1000000, 10000000)) 35 | html = requests.get(url, headers=headers).text 36 | t1 = re.findall('id="codeKey"(.*?)id="couponBatch"', html, re.S)[0] 37 | try: 38 | ck = re.findall('authCodeImg.action\?key=(.*?)"', html, re.S)[0] 39 | ir = requests.get("http://coupon.m.jd.com/authCode/authCodeImg.action?key=" + str(ck), 40 | headers=headers) 41 | save_img('C:\\temp\\' + rdname + '.png', ir) 42 | validatecode = fuck_code_rk(self.rk_um, self.rk_pw, 'C:\\temp\\' + rdname + '.png') 43 | except: 44 | print(decoder('无需验证码,尝试直接领取')) 45 | validatecode = '' 46 | ck = '' 47 | datax = {'sid': re.findall('sid=(.*?)"', html, re.S)[0], 48 | 'codeKey': ck, 49 | 'validateCode': validatecode, 50 | 'roleId': re.findall('value="(.*?)"', t1, re.S)[0], 51 | 'key': re.findall('value="(.*?)"', t1, re.S)[1], 52 | 'couponKey': re.findall('value="(.*?)"', t1, re.S)[2], 53 | 'activeId': re.findall('value="(.*?)"', t1, re.S)[3], 54 | 'couponType': re.findall('value="(.*?)"', t1, re.S)[4], 55 | 'to': re.findall('value="(.*?)"', t1, re.S)[5]} 56 | now = requests.post('http://coupon.m.jd.com/coupons/submit.json', headers=headers, data=datax).text 57 | print (re.findall('"returnMsg":"(.*?)"', now, re.S)[0],end='') 58 | times += 1 59 | print(times) 60 | 61 | def get_coupon_a(self, url, start, endtime,delay): 62 | global times 63 | enabled = 0 64 | 65 | while datetime.datetime.now() <= endtime: 66 | while endtime >= datetime.datetime.now() >= start: 67 | self.coupon(url) 68 | time.sleep(delay) 69 | time.sleep(0.1) 70 | 71 | print('Times Up!Process End.') 72 | 73 | def ajd_coupon(self, url, starttime): 74 | headers = {'Cookie': self.ck_pc, 75 | 'Referer': url 76 | } 77 | enabled = 0 78 | while enabled == 0: 79 | time.sleep(0.1) 80 | if datetime.datetime.now() >= starttime: 81 | a = requests.get(url, headers=headers).text 82 | print(a) 83 | enabled = 1 84 | 85 | def get_ajd_coupon(self, url, starttime): 86 | starttime = datetime.datetime.strptime(starttime, '%Y-%m-%d %H:%M:%S') 87 | threading.Thread(target=self.ajd_coupon, args=(url, starttime,)).start() 88 | 89 | 90 | def get_ajd_list(url): 91 | coupon_dict = {} 92 | html = requests.get(url).text 93 | coupon = re.findall('
      ', html, re.S) 94 | for each in coupon: 95 | title = re.findall('

      (.*?)', each, re.S)[0].replace('\n', '').replace(' ', '') 97 | off_price = re.findall('(.*?)', each, re.S)[0] 98 | typ = re.findall('div class="typ-txt">(.*?)

      ', each, re.S)[0] 99 | data_linkurl = 'http://' + re.findall('data-linkUrl="//(.*?)"', each, re.S)[0] 100 | try: 101 | datakey = re.findall('data-key="(.*?)"', each, re.S)[0] 102 | url = 'http://a.jd.com/ajax/freeGetCoupon.html?key=' + datakey + '&r=0.7308938041372057' 103 | print (title, typ, min_price, off_price, 'RMB', url, 'Available:', data_linkurl) 104 | coupon_dict[datakey] = {'title': title, 105 | 'min_price': min_price, 106 | 'off_price': off_price, 107 | 'datakey': datakey, 108 | 'data_linkurl': data_linkurl, 109 | 'type': typ} 110 | except: 111 | data_id = re.findall('data-id="(.*?)"', each, re.S)[0] 112 | data_bean = re.findall('data-bean="(.*?)"', each, re.S)[0] 113 | url = 'http://a.jd.com/ajax/beanExchangeCoupon.html?id=' + data_id + '&r=0.5559653794026669' 114 | print (title, typ, min_price, off_price, 'RMB', url, data_bean, 'JD Bean', 'Available:', data_linkurl) 115 | coupon_dict[data_id] = {'title': title, 116 | 'min_price': min_price, 117 | 'off_price': off_price, 118 | 'data_id': data_id, 119 | 'data_linkurl': data_linkurl, 120 | 'data_bean': data_bean, 121 | 'type': typ} 122 | 123 | return coupon_dict 124 | 125 | 126 | def multi_couponA(a, b, c, d, count,delay,start, end, url): 127 | t = {} 128 | for x in range(1, count + 1): 129 | print (decoder('开始登陆第' + str(x) + '个账号')) 130 | t[x] = Coupon(a, b, c, d) 131 | t[x].login() 132 | print (decoder('第' + str(x) + '线程登陆成功')) 133 | t[x].coupon_modeA(url, start, end,delay) 134 | -------------------------------------------------------------------------------- /JDPackage/datacontrol.py: -------------------------------------------------------------------------------- 1 | # encoding=utf8 2 | import csv 3 | import platform 4 | from email.mime.text import MIMEText 5 | import smtplib 6 | 7 | version = int(platform.python_version()[0]) 8 | 9 | 10 | def loadCSVfile(file_name): 11 | if version == 3: 12 | csv_reader=csv.reader(open(file_name,'r',encoding='utf8')) 13 | return csv_reader 14 | else: 15 | try: 16 | csv_reader = csv.reader(open(file_name)) 17 | except: 18 | raise Exception('请确认Cookies.csv文件存在!如不存在请复制JDPackage中的Cookies.csv到程序文件目录中!') 19 | return csv_reader 20 | 21 | 22 | 23 | def writeCSVfile(filename, data): 24 | if version == 3: 25 | with open(filename, "w", newline="") as datacsv: 26 | csv_writer = csv.writer(datacsv, dialect="excel") 27 | for each in data: 28 | csv_writer.writerow(each) 29 | if version == 2: 30 | csvfile = file(filename, 'wb') 31 | writer = csv.writer(csvfile) 32 | writer.writerows(data) 33 | csvfile.close() 34 | print('Write to ' + str(filename) + ' Complete!') 35 | 36 | 37 | def decoder(string): 38 | if version == 2: 39 | return string.decode('utf8') 40 | else: 41 | return string 42 | 43 | 44 | def spider_file_csv(lc_dict, filename): 45 | try: 46 | s = str(lc_dict) 47 | f = open(filename, 'w') 48 | f.writelines(s) 49 | f.close() 50 | print('Write to ' + str(filename) + ' Complete!') 51 | except Exception as Err: 52 | print(Err) 53 | 54 | 55 | def emailto(destination, text, subject, SMTPserver, sender, password): 56 | try: 57 | msg = MIMEText(text) 58 | msg['Subject'] = subject 59 | msg['From'] = sender 60 | msg['To'] = destination 61 | mailserver = smtplib.SMTP(SMTPserver, 25) 62 | mailserver.login(sender, password) 63 | mailserver.sendmail(sender, [destination], msg.as_string()) 64 | mailserver.quit() 65 | print ('Send to ' + destination + ' Complete!') 66 | except Exception as err: 67 | print (err) 68 | 69 | def save_img(imgLocate, ir): 70 | try: 71 | fp = open(imgLocate, 'wb') 72 | fp.write(ir.content) 73 | fp.close() 74 | return True 75 | except Exception as Err: 76 | print (Err) 77 | -------------------------------------------------------------------------------- /JDPackage/lotterypack.py: -------------------------------------------------------------------------------- 1 | #encoding=utf8 2 | from __future__ import print_function 3 | from .datacontrol import * 4 | import requests 5 | import time 6 | import re 7 | import datetime 8 | import threading 9 | from selenium import webdriver 10 | import warnings 11 | warnings.filterwarnings("ignore") 12 | 13 | 14 | def lottery_time(userid, code, timet, delay, proxylist=None): 15 | time1 = datetime.datetime.strptime(timet, '%Y-%m-%d %H:%M:%S') 16 | if proxylist is None: 17 | proxylist = [] 18 | cookiedt = [] 19 | msglist = [] 20 | ps = 0 21 | print('Verify Time:', timet) 22 | try: 23 | cookielist = loadCSVfile('cookies.csv') 24 | except: 25 | raise Exception('请确认Cookies文件存在!') 26 | for each in cookielist: 27 | try: 28 | if str(each[0]) == str(userid): 29 | cookiedt.append(each[1]) 30 | print(each[2], 'Ready!') 31 | except: 32 | pass 33 | proxies = [] 34 | if proxylist: 35 | ps = 1 # 代理模式开启 36 | for each in proxylist: 37 | proxies.append({'http': 'http://' + str(each[0]) + ':' + str(each[1])}) 38 | enabled = 1 39 | while enabled == 1: 40 | time.sleep(0.1) 41 | if datetime.datetime.now() >= time1: 42 | for each in cookiedt: 43 | ck = 1 44 | headers = {'cookie': each, 45 | 'Referer': 'http://l.activity.jd.com/lottery/lottery_chance.action?lotteryCode=' + code} 46 | if ps == 1: 47 | status = 0 48 | while status == 0: 49 | try: 50 | print(proxies[0]) 51 | goprince = requests.get( 52 | 'http://l.activity.jd.com/lottery/lottery_start.action?lotteryCode=' + code, 53 | headers=headers, proxies=proxies[0], verify=False).text 54 | if decoder('登录') in goprince: 55 | print(decoder('ID为') ,userid,decoder('的Cookies过期!'), each) 56 | ck = 0 57 | status = 1 58 | except: 59 | print("Network Error!Change Proxy and Retrying……") 60 | del proxies[0] 61 | if ps == 0: 62 | goprince = requests.get('http://l.activity.jd.com/lottery/lottery_start.action?lotteryCode=' + code, 63 | headers=headers, verify=False).text 64 | if decoder('登录') in goprince: 65 | print(decoder('ID为') , userid , decoder('的Cookies过期!'), each) 66 | ck = 0 67 | winner = re.findall('"winner":(.*?)}', goprince, re.S) 68 | if str(winner) == '[u\'true\']': 69 | print(code) 70 | if ck == 1: 71 | print(goprince) 72 | msglist.append(goprince) 73 | # 如需屏蔽未中奖消息,请注释如下内容 74 | else: 75 | print(code) 76 | if ck == 1: 77 | print(goprince) 78 | msglist.append(goprince) 79 | # ---------------------------- 80 | time.sleep(delay) 81 | enabled = 0 82 | # Fix later 83 | # f = open('f.txt', 'a') 84 | # for each in msglist: 85 | # f.write(decoder(each)) 86 | # f.write('\n') 87 | # f.close() 88 | print('Finished!') 89 | 90 | 91 | def add_lottery(userid, code, timet, delay, proxylist=None): 92 | if proxylist is None: 93 | proxylist = [] 94 | threading.Thread(target=lottery_time, args=(userid, code, timet, delay, proxylist)).start() 95 | print(code) 96 | time.sleep(0.1) 97 | 98 | 99 | def yuyue(userid, url): 100 | cookiedt=[] 101 | try: 102 | cookielist = loadCSVfile('cookies.csv') 103 | except: 104 | raise Exception('请确认Cookies文件存在!') 105 | for each in cookielist: 106 | try: 107 | if str(each[0]) == str(userid): 108 | cookiedt.append(each[1]) 109 | except: 110 | pass 111 | for each in cookiedt: 112 | headers = {'Cookie': each,'Referer':url} 113 | html = requests.get(url,headers=headers,verify=False).text 114 | result = '' 115 | try: 116 | result = re.findall('

      (.*?)

      ', html, re.S)[0] 117 | result=result.replace('','').replace('','') 118 | except Exception as err: 119 | print (err) 120 | pass 121 | print(result) 122 | 123 | 124 | def read_lotteryfile(dictfile): 125 | dc = dict(eval(open(dictfile, 'rb').read())) 126 | for k, value in dc.items(): 127 | if k != '': 128 | print(' ') 129 | print(k, value) 130 | headers = {'Referer': value} 131 | getinfo = requests.get('http://ls.activity.jd.com/lotteryApi/getLotteryInfo.action?lotteryCode=' + k, 132 | headers=headers, verify=False).text 133 | endtime = re.findall('"endTime":"(.*?)"', getinfo, re.S)[0] 134 | details = requests.get(value, verify=False).text 135 | title = re.findall('(.*?)', driver.page_source, re.S) 177 | time.sleep(1) 178 | for each in re.findall('(.*?)', driver.page_source, re.S): 179 | try: 180 | ip = re.findall('(.*?)', each, re.S)[0] 181 | port = re.findall('(.*?)', each, re.S)[0] 182 | 183 | tp = re.findall('(.*?)', each, re.S)[0] 184 | loc = re.findall('(.*?)', each, re.S)[0] 185 | speed = re.findall('(.*?)', each, re.S)[0] 186 | last = re.findall('(.*?)', each, re.S)[0] 187 | 188 | print (ip, port, tp, last) 189 | data.append((ip, port, tp, last)) 190 | except Exception as err: 191 | print(err) 192 | driver.quit() 193 | writeCSVfile(filename, data) 194 | 195 | 196 | def filter_iplist(filename, newfilename, timeout): 197 | successlist = [] 198 | f = loadCSVfile(filename) 199 | for each in f: 200 | try: 201 | proxies = [{'http': 'http://' + str(each[0]) + ':' + str(each[1])}] 202 | requests.get('http://www.jd.com', proxies=proxies[0], timeout=timeout, verify=False) 203 | print ('Success', each[0], ':', each[1]) 204 | successlist.append([each[0], each[1], each[2], each[3]]) 205 | except: 206 | print ('Failed', each[0], ':', each[1]) 207 | writeCSVfile(newfilename, successlist) 208 | 209 | -------------------------------------------------------------------------------- /JDPackage/mlogin.py: -------------------------------------------------------------------------------- 1 | # encoding=utf8 2 | from __future__ import print_function 3 | import requests 4 | import re 5 | import os 6 | import random 7 | from .rk import * 8 | from .datacontrol import * 9 | from selenium import webdriver 10 | 11 | 12 | def get_dat(username, password, rand): 13 | dat = """ 14 | """ 23 | open('dat.html', 'w').write(dat) 24 | 25 | 26 | def get_pwd(pwd, str_rsaString): 27 | a = ''' 465 | ''' 466 | open('pwd.html', 'w').write(a) 467 | 468 | 469 | def login(username, pwd, rk_um, rk_pwd): 470 | url = 'http://passport.m.jd.com/user/login.action?returnurl=https://m.jd.com?indexloc=1' 471 | cookiestr = '' 472 | session = requests.session() 473 | headers = { 474 | 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) ' 475 | 'Chrome/54.0.2840.59 Safari/537.36 115Browser/8.0.0', 476 | 'Accept': 'application / json', 477 | } 478 | rdname = str(random.randint(1000000, 10000000)) 479 | html = session.get(url, headers=headers, verify=False).text 480 | str_rsaString = re.findall('str_rsaString = \'(.*?)\'', html, re.S)[0] 481 | str_kenString = re.findall('str_kenString = \'(.*?)\'', html, re.S)[0] 482 | authimgurl = 'http://plogin.m.jd.com' + re.findall('(.*?) ', driver.page_source, re.S)[0] 492 | driver.get('file:///' + os.getcwd().replace("\\", "/") + '/pwd.html') 493 | pwd = re.findall('(.*?) ', driver.page_source, re.S)[0] 494 | driver.quit() 495 | datax = {'username': username, 496 | 'pwd': pwd, 497 | 'remember': 'true', 498 | 's_token': str_kenString, 499 | 'dat': dat, 500 | 'wlfstk_datk': dat, 501 | 'authcode': authcode 502 | } 503 | 504 | headers = { 505 | 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) ' 506 | 'Chrome/54.0.2840.59 Safari/537.36 115Browser/8.0.0', 507 | 'Referer': url} 508 | 509 | result = session.post('http://plogin.m.jd.com/cgi-bin/m/domlogin', data=datax, 510 | headers=headers).text 511 | errcode = re.findall('"errcode" : (.*?),', result, re.S)[0] 512 | if errcode == '0': 513 | print (decoder('京东M端登陆成功!')) 514 | else: 515 | Ex = re.findall('"message" : (.*?),', result, re.S)[0] 516 | print (Ex) 517 | raise Exception('Error!') 518 | for k, value in session.cookies.items(): 519 | cookiestr = cookiestr + k + '=' + value + ';' 520 | return cookiestr[:-1] 521 | -------------------------------------------------------------------------------- /JDPackage/mloginPYV8.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | from .rk import * 3 | from .datacontrol import * 4 | import PyV8 5 | import requests 6 | import re 7 | import random 8 | 9 | ''' 10 | 11 | JD MLogin Module' 12 | Cracked:HiddenStrawberry' 13 | 14 | bug: 15 | - USER_FLAG_CHECK and sid was non-existent in cookies(Unable to get coupon) 16 | solution: 17 | - Phantomjs to get and load into cookies 18 | 19 | ''' 20 | 21 | def login(username, pwd, rk_um, rk_pwd): 22 | url = 'https://passport.m.jd.com/user/login.action?returnurl=https://m.jd.com?indexloc=1' 23 | cookiestr = '' 24 | session = requests.session() 25 | headers = { 26 | 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) ' 27 | 'Chrome/54.0.2840.59 Safari/537.36 115Browser/8.0.0', 28 | 'Accept': 'application / json', 29 | } 30 | rdname = str(random.randint(1000000, 10000000)) 31 | html = session.get(url, headers=headers, verify=False).text 32 | str_rsaString = re.findall('str_rsaString = \'(.*?)\'', html, re.S)[0] 33 | str_kenString = re.findall('str_kenString = \'(.*?)\'', html, re.S)[0] 34 | authimgurl = 'http://plogin.m.jd.com' + re.findall('>>(32-iShiftBits))}function md5_AddUnsigned(lX,lY){var lX4,lY4,lX8,lY8,lResult;lX8=(lX&0x80000000);lY8=(lY&0x80000000);lX4=(lX&0x40000000);lY4=(lY&0x40000000);lResult=(lX&0x3FFFFFFF)+(lY&0x3FFFFFFF);if(lX4&lY4){return(lResult^0x80000000^lX8^lY8)}if(lX4|lY4){if(lResult&0x40000000){return(lResult^0xC0000000^lX8^lY8)}else{return(lResult^0x40000000^lX8^lY8)}}else{return(lResult^lX8^lY8)}}function md5_F(x,y,z){return(x&y)|((~x)&z)}function md5_G(x,y,z){return(x&z)|(y&(~z))}function md5_H(x,y,z){return(x^y^z)}function md5_I(x,y,z){return(y^(x|(~z)))}function md5_FF(a,b,c,d,x,s,ac){a=md5_AddUnsigned(a,md5_AddUnsigned(md5_AddUnsigned(md5_F(b,c,d),x),ac));return md5_AddUnsigned(md5_RotateLeft(a,s),b)};function md5_GG(a,b,c,d,x,s,ac){a=md5_AddUnsigned(a,md5_AddUnsigned(md5_AddUnsigned(md5_G(b,c,d),x),ac));return md5_AddUnsigned(md5_RotateLeft(a,s),b)};function md5_HH(a,b,c,d,x,s,ac){a=md5_AddUnsigned(a,md5_AddUnsigned(md5_AddUnsigned(md5_H(b,c,d),x),ac));return md5_AddUnsigned(md5_RotateLeft(a,s),b)};function md5_II(a,b,c,d,x,s,ac){a=md5_AddUnsigned(a,md5_AddUnsigned(md5_AddUnsigned(md5_I(b,c,d),x),ac));return md5_AddUnsigned(md5_RotateLeft(a,s),b)};function md5_ConvertToWordArray(string){var lWordCount;var lMessageLength=string.length;var lNumberOfWords_temp1=lMessageLength+8;var lNumberOfWords_temp2=(lNumberOfWords_temp1-(lNumberOfWords_temp1%64))/64;var lNumberOfWords=(lNumberOfWords_temp2+1)*16;var lWordArray=Array(lNumberOfWords-1);var lBytePosition=0;var lByteCount=0;while(lByteCount>>29;return lWordArray};function md5_WordToHex(lValue){var WordToHexValue="",WordToHexValue_temp="",lByte,lCount;for(lCount=0;lCount<=3;lCount++){lByte=(lValue>>>(lCount*8))&255;WordToHexValue_temp="0"+lByte.toString(16);WordToHexValue=WordToHexValue+WordToHexValue_temp.substr(WordToHexValue_temp.length-2,2)}return WordToHexValue};function md5_Utf8Encode(string){string=string.replace(/\\r\\n/g,"\\n");var utftext="";for(var n=0;n127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128)}else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128)}}return utftext};var x=Array();var k,AA,BB,CC,DD,a,b,c,d;var S11=7,S12=12,S13=17,S14=22;var S21=5,S22=9,S23=14,S24=20;var S31=4,S32=11,S33=16,S34=23;var S41=6,S42=10,S43=15,S44=21;string=md5_Utf8Encode(string);x=md5_ConvertToWordArray(string);a=0x67452301;b=0xEFCDAB89;c=0x98BADCFE;d=0x10325476;for(k=0;k> 2); 92 | out += base64EncodeChars.charAt((c1 & 0x3) << 4); 93 | out += "=="; 94 | break; 95 | } 96 | c2 = str.charCodeAt(i++); 97 | if(i == len) 98 | { 99 | out += base64EncodeChars.charAt(c1 >> 2); 100 | out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)); 101 | out += base64EncodeChars.charAt((c2 & 0xF) << 2); 102 | out += "="; 103 | break; 104 | } 105 | c3 = str.charCodeAt(i++); 106 | out += base64EncodeChars.charAt(c1 >> 2); 107 | out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)); 108 | out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6)); 109 | out += base64EncodeChars.charAt(c3 & 0x3F); 110 | } 111 | return out; 112 | } 113 | 114 | function utf16to8(str) { 115 | var out, i, len, c; 116 | out = ""; 117 | len = str.length; 118 | for(i = 0; i < len; i++) { 119 | c = str.charCodeAt(i); 120 | if ((c >= 0x0001) && (c <= 0x007F)) { 121 | out += str.charAt(i); 122 | } else if (c > 0x07FF) { 123 | out += String.fromCharCode(0xE0 | ((c >>12) & 0x0F)); 124 | out += String.fromCharCode(0x80 | ((c >>6) & 0x3F)); 125 | out += String.fromCharCode(0x80 | ((c >>0) & 0x3F)); 126 | } else { 127 | out += String.fromCharCode(0xC0 | ((c >>6) & 0x1F)); 128 | out += String.fromCharCode(0x80 | ((c >>0) & 0x3F)); 129 | } 130 | } 131 | return out; 132 | } 133 | function utf8to16(str) { 134 | var out, i, len, c; 135 | var char2, char3; 136 | out = ""; 137 | len = str.length; 138 | i = 0; 139 | while(i < len) { 140 | c = str.charCodeAt(i++); 141 | switch(c >> 4) 142 | { 143 | case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: 144 | // 0xxxxxxx 145 | out += str.charAt(i-1); 146 | break; 147 | case 12: case 13: 148 | // 110x xxxx10xx xxxx 149 | char2 = str.charCodeAt(i++); 150 | out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F)); 151 | break; 152 | case 14: 153 | char2 = str.charCodeAt(i++); 154 | char3 = str.charCodeAt(i++); 155 | out += String.fromCharCode(((c & 0x0F) << 12) | 156 | ((char2 & 0x3F) << 6) | 157 | ((char3 & 0x3F) << 0)); 158 | break; 159 | } 160 | } 161 | return out; 162 | } 163 | 164 | function doit() { 165 | var f = document.f 166 | f.output.value = base64encode(utf16to8(f.source.value)) 167 | f.decode.value = utf8to16(base64decode(f.output.value)) 168 | } 169 | 170 | function BarrettMu(i) { 171 | this.modulus = biCopy(i), this.k = biHighIndex(this.modulus) + 1; 172 | var t = new BigInt; 173 | t.digits[2 * this.k] = 1, this.mu = biDivide(t, this.modulus), this.bkplus1 = new BigInt, this.bkplus1.digits[this.k + 1] = 1, this.modulo = BarrettMu_modulo, this.multiplyMod = BarrettMu_multiplyMod, this.powMod = BarrettMu_powMod 174 | } 175 | function BarrettMu_modulo(i) { 176 | var t = biDivideByRadixPower(i, this.k - 1), 177 | r = biMultiply(t, this.mu), 178 | e = biDivideByRadixPower(r, this.k + 1), 179 | n = biModuloByRadixPower(i, this.k + 1), 180 | g = biMultiply(e, this.modulus), 181 | s = biModuloByRadixPower(g, this.k + 1), 182 | d = biSubtract(n, s); 183 | d.isNeg && (d = biAdd(d, this.bkplus1)); 184 | for (var o = biCompare(d, this.modulus) >= 0; o;) d = biSubtract(d, this.modulus), o = biCompare(d, this.modulus) >= 0; 185 | return d 186 | } 187 | function BarrettMu_multiplyMod(i, t) { 188 | var r = biMultiply(i, t); 189 | return this.modulo(r) 190 | } 191 | function BarrettMu_powMod(i, t) { 192 | var r = new BigInt; 193 | r.digits[0] = 1; 194 | for (var e = i, n = t;;) { 195 | if (0 != (1 & n.digits[0]) && (r = this.multiplyMod(r, e)), n = biShiftRight(n, 1), 0 == n.digits[0] && 0 == biHighIndex(n)) break; 196 | e = this.multiplyMod(e, e) 197 | } 198 | return r 199 | } 200 | function setMaxDigits(i) { 201 | maxDigits = i, ZERO_ARRAY = new Array(maxDigits); 202 | for (var t = 0; t < ZERO_ARRAY.length; t++) ZERO_ARRAY[t] = 0; 203 | bigZero = new BigInt, bigOne = new BigInt, bigOne.digits[0] = 1 204 | } 205 | function BigInt(i) { 206 | "boolean" == typeof i && 1 == i ? this.digits = null : this.digits = ZERO_ARRAY.slice(0), this.isNeg = !1 207 | } 208 | function biFromDecimal(i) { 209 | for (var t, r = "-" == i.charAt(0), e = r ? 1 : 0; e < i.length && "0" == i.charAt(e);)++e; 210 | if (e == i.length) t = new BigInt; 211 | else { 212 | var n = i.length - e, 213 | g = n % dpl10; 214 | for (0 == g && (g = dpl10), t = biFromNumber(Number(i.substr(e, g))), e += g; e < i.length;) t = biAdd(biMultiply(t, lr10), biFromNumber(Number(i.substr(e, dpl10)))), e += dpl10; 215 | t.isNeg = r 216 | } 217 | return t 218 | } 219 | function biCopy(i) { 220 | var t = new BigInt((!0)); 221 | return t.digits = i.digits.slice(0), t.isNeg = i.isNeg, t 222 | } 223 | function biFromNumber(i) { 224 | var t = new BigInt; 225 | t.isNeg = i < 0, i = Math.abs(i); 226 | for (var r = 0; i > 0;) t.digits[r++] = i & maxDigitVal, i >>= biRadixBits; 227 | return t 228 | } 229 | function reverseStr(i) { 230 | for (var t = "", r = i.length - 1; r > -1; --r) t += i.charAt(r); 231 | return t 232 | } 233 | function biToString(i, t) { 234 | var r = new BigInt; 235 | r.digits[0] = t; 236 | for (var e = biDivideModulo(i, r), n = hexatrigesimalToChar[e[1].digits[0]]; 1 == biCompare(e[0], bigZero);) e = biDivideModulo(e[0], r), digit = e[1].digits[0], n += hexatrigesimalToChar[e[1].digits[0]]; 237 | return (i.isNeg ? "-" : "") + reverseStr(n) 238 | } 239 | function biToDecimal(i) { 240 | var t = new BigInt; 241 | t.digits[0] = 10; 242 | for (var r = biDivideModulo(i, t), e = String(r[1].digits[0]); 1 == biCompare(r[0], bigZero);) r = biDivideModulo(r[0], t), e += String(r[1].digits[0]); 243 | return (i.isNeg ? "-" : "") + reverseStr(e) 244 | } 245 | function digitToHex(t) { 246 | var r = 15, 247 | e = ""; 248 | for (i = 0; i < 4; ++i) e += hexToChar[t & r], t >>>= 4; 249 | return reverseStr(e) 250 | } 251 | function biToHex(i) { 252 | for (var t = "", r = (biHighIndex(i), biHighIndex(i)); r > -1; --r) t += digitToHex(i.digits[r]); 253 | return t 254 | } 255 | function charToHex(i) { 256 | var t, r = 48, 257 | e = r + 9, 258 | n = 97, 259 | g = n + 25, 260 | s = 65, 261 | d = 90; 262 | return t = i >= r && i <= e ? i - r : i >= s && i <= d ? 10 + i - s : i >= n && i <= g ? 10 + i - n : 0 263 | } 264 | function hexToDigit(i) { 265 | for (var t = 0, r = Math.min(i.length, 4), e = 0; e < r; ++e) t <<= 4, t |= charToHex(i.charCodeAt(e)); 266 | return t 267 | } 268 | function biFromHex(i) { 269 | for (var t = new BigInt, r = i.length, e = r, n = 0; e > 0; e -= 4, ++n) t.digits[n] = hexToDigit(i.substr(Math.max(e - 4, 0), Math.min(e, 4))); 270 | return t 271 | } 272 | function biFromString(i, t) { 273 | var r = "-" == i.charAt(0), 274 | e = r ? 1 : 0, 275 | n = new BigInt, 276 | g = new BigInt; 277 | g.digits[0] = 1; 278 | for (var s = i.length - 1; s >= e; s--) { 279 | var d = i.charCodeAt(s), 280 | o = charToHex(d), 281 | a = biMultiplyDigit(g, o); 282 | n = biAdd(n, a), g = biMultiplyDigit(g, t) 283 | } 284 | return n.isNeg = r, n 285 | } 286 | function biToBytes(i) { 287 | for (var t = "", r = biHighIndex(i); r > -1; --r) t += digitToBytes(i.digits[r]); 288 | return t 289 | } 290 | function digitToBytes(i) { 291 | var t = String.fromCharCode(255 & i); 292 | i >>>= 8; 293 | var r = String.fromCharCode(255 & i); 294 | return r + t 295 | } 296 | function biDump(i) { 297 | return (i.isNeg ? "-" : "") + i.digits.join(" ") 298 | } 299 | function biAdd(i, t) { 300 | var r; 301 | if (i.isNeg != t.isNeg) t.isNeg = !t.isNeg, r = biSubtract(i, t), t.isNeg = !t.isNeg; 302 | else { 303 | r = new BigInt; 304 | for (var e, n = 0, g = 0; g < i.digits.length; ++g) e = i.digits[g] + t.digits[g] + n, r.digits[g] = 65535 & e, n = Number(e >= biRadix); 305 | r.isNeg = i.isNeg 306 | } 307 | return r 308 | } 309 | function biSubtract(i, t) { 310 | var r; 311 | if (i.isNeg != t.isNeg) t.isNeg = !t.isNeg, r = biAdd(i, t), t.isNeg = !t.isNeg; 312 | else { 313 | r = new BigInt; 314 | var e, n; 315 | n = 0; 316 | for (var g = 0; g < i.digits.length; ++g) e = i.digits[g] - t.digits[g] + n, r.digits[g] = 65535 & e, r.digits[g] < 0 && (r.digits[g] += biRadix), n = 0 - Number(e < 0); 317 | if (n == -1) { 318 | n = 0; 319 | for (var g = 0; g < i.digits.length; ++g) e = 0 - r.digits[g] + n, r.digits[g] = 65535 & e, r.digits[g] < 0 && (r.digits[g] += biRadix), n = 0 - Number(e < 0); 320 | r.isNeg = !i.isNeg 321 | } else r.isNeg = i.isNeg 322 | } 323 | return r 324 | } 325 | function biHighIndex(i) { 326 | for (var t = i.digits.length - 1; t > 0 && 0 == i.digits[t];)--t; 327 | return t 328 | } 329 | function biNumBits(i) { 330 | var t, r = biHighIndex(i), 331 | e = i.digits[r], 332 | n = (r + 1) * bitsPerDigit; 333 | for (t = n; t > n - bitsPerDigit && 0 == (32768 & e); --t) e <<= 1; 334 | return t 335 | } 336 | function biMultiply(i, t) { 337 | for (var r, e, n, g = new BigInt, s = biHighIndex(i), d = biHighIndex(t), o = 0; o <= d; ++o) { 338 | for (r = 0, n = o, j = 0; j <= s; ++j, ++n) e = g.digits[n] + i.digits[j] * t.digits[o] + r, g.digits[n] = e & maxDigitVal, r = e >>> biRadixBits; 339 | g.digits[o + s + 1] = r 340 | } 341 | return g.isNeg = i.isNeg != t.isNeg, g 342 | } 343 | function biMultiplyDigit(i, t) { 344 | var r, e, n; 345 | result = new BigInt, r = biHighIndex(i), e = 0; 346 | for (var g = 0; g <= r; ++g) n = result.digits[g] + i.digits[g] * t + e, result.digits[g] = n & maxDigitVal, e = n >>> biRadixBits; 347 | return result.digits[1 + r] = e, result 348 | } 349 | function arrayCopy(i, t, r, e, n) { 350 | for (var g = Math.min(t + n, i.length), s = t, d = e; s < g; ++s, ++d) r[d] = i[s] 351 | } 352 | function biShiftLeft(i, t) { 353 | var r = Math.floor(t / bitsPerDigit), 354 | e = new BigInt; 355 | arrayCopy(i.digits, 0, e.digits, r, e.digits.length - r); 356 | for (var n = t % bitsPerDigit, g = bitsPerDigit - n, s = e.digits.length - 1, d = s - 1; s > 0; --s, --d) e.digits[s] = e.digits[s] << n & maxDigitVal | (e.digits[d] & highBitMasks[n]) >>> g; 357 | return e.digits[0] = e.digits[s] << n & maxDigitVal, e.isNeg = i.isNeg, e 358 | } 359 | function biShiftRight(i, t) { 360 | var r = Math.floor(t / bitsPerDigit), 361 | e = new BigInt; 362 | arrayCopy(i.digits, r, e.digits, 0, i.digits.length - r); 363 | for (var n = t % bitsPerDigit, g = bitsPerDigit - n, s = 0, d = s + 1; s < e.digits.length - 1; ++s, ++d) e.digits[s] = e.digits[s] >>> n | (e.digits[d] & lowBitMasks[n]) << g; 364 | return e.digits[e.digits.length - 1] >>>= n, e.isNeg = i.isNeg, e 365 | } 366 | function biMultiplyByRadixPower(i, t) { 367 | var r = new BigInt; 368 | return arrayCopy(i.digits, 0, r.digits, t, r.digits.length - t), r 369 | } 370 | function biDivideByRadixPower(i, t) { 371 | var r = new BigInt; 372 | return arrayCopy(i.digits, t, r.digits, 0, r.digits.length - t), r 373 | } 374 | function biModuloByRadixPower(i, t) { 375 | var r = new BigInt; 376 | return arrayCopy(i.digits, 0, r.digits, 0, t), r 377 | } 378 | function biCompare(i, t) { 379 | if (i.isNeg != t.isNeg) return 1 - 2 * Number(i.isNeg); 380 | for (var r = i.digits.length - 1; r >= 0; --r) if (i.digits[r] != t.digits[r]) return i.isNeg ? 1 - 2 * Number(i.digits[r] > t.digits[r]) : 1 - 2 * Number(i.digits[r] < t.digits[r]); 381 | return 0 382 | } 383 | function biDivideModulo(i, t) { 384 | var r, e, n = biNumBits(i), 385 | g = biNumBits(t), 386 | s = t.isNeg; 387 | if (n < g) return i.isNeg ? (r = biCopy(bigOne), r.isNeg = !t.isNeg, i.isNeg = !1, t.isNeg = !1, e = biSubtract(t, i), i.isNeg = !0, t.isNeg = s) : (r = new BigInt, e = biCopy(i)), new Array(r, e); 388 | r = new BigInt, e = i; 389 | for (var d = Math.ceil(g / bitsPerDigit) - 1, o = 0; t.digits[d] < biHalfRadix;) t = biShiftLeft(t, 1), ++o, ++g, d = Math.ceil(g / bitsPerDigit) - 1; 390 | e = biShiftLeft(e, o), n += o; 391 | for (var a = Math.ceil(n / bitsPerDigit) - 1, u = biMultiplyByRadixPower(t, a - d); biCompare(e, u) != -1;)++r.digits[a - d], e = biSubtract(e, u); 392 | for (var b = a; b > d; --b) { 393 | var l = b >= e.digits.length ? 0 : e.digits[b], 394 | h = b - 1 >= e.digits.length ? 0 : e.digits[b - 1], 395 | f = b - 2 >= e.digits.length ? 0 : e.digits[b - 2], 396 | c = d >= t.digits.length ? 0 : t.digits[d], 397 | m = d - 1 >= t.digits.length ? 0 : t.digits[d - 1]; 398 | l == c ? r.digits[b - d - 1] = maxDigitVal : r.digits[b - d - 1] = Math.floor((l * biRadix + h) / c); 399 | for (var x = r.digits[b - d - 1] * (c * biRadix + m), v = l * biRadixSquared + (h * biRadix + f); x > v;)--r.digits[b - d - 1], x = r.digits[b - d - 1] * (c * biRadix | m), v = l * biRadix * biRadix + (h * biRadix + f); 400 | u = biMultiplyByRadixPower(t, b - d - 1), e = biSubtract(e, biMultiplyDigit(u, r.digits[b - d - 1])), e.isNeg && (e = biAdd(e, u), --r.digits[b - d - 1]) 401 | } 402 | return e = biShiftRight(e, o), r.isNeg = i.isNeg != s, i.isNeg && (r = s ? biAdd(r, bigOne) : biSubtract(r, bigOne), t = biShiftRight(t, o), e = biSubtract(t, e)), 0 == e.digits[0] && 0 == biHighIndex(e) && (e.isNeg = !1), new Array(r, e) 403 | } 404 | function biDivide(i, t) { 405 | return biDivideModulo(i, t)[0] 406 | } 407 | function biModulo(i, t) { 408 | return biDivideModulo(i, t)[1] 409 | } 410 | function biMultiplyMod(i, t, r) { 411 | return biModulo(biMultiply(i, t), r) 412 | } 413 | function biPow(i, t) { 414 | for (var r = bigOne, e = i;;) { 415 | if (0 != (1 & t) && (r = biMultiply(r, e)), t >>= 1, 0 == t) break; 416 | e = biMultiply(e, e) 417 | } 418 | return r 419 | } 420 | function biPowMod(i, t, r) { 421 | for (var e = bigOne, n = i, g = t;;) { 422 | if (0 != (1 & g.digits[0]) && (e = biMultiplyMod(e, n, r)), g = biShiftRight(g, 1), 0 == g.digits[0] && 0 == biHighIndex(g)) break; 423 | n = biMultiplyMod(n, n, r) 424 | } 425 | return e 426 | } 427 | function RSAKeyPair(i, t, r, e) { 428 | this.e = biFromHex(i), this.d = biFromHex(t), this.m = biFromHex(r), "number" != typeof e ? this.chunkSize = 2 * biHighIndex(this.m) : this.chunkSize = e / 8, this.radix = 16, this.barrett = new BarrettMu(this.m) 429 | } 430 | function encryptedString(i, t, r, e) { 431 | var n, g, s, d, o, a, u, b, l, h, f = new Array, 432 | c = t.length, 433 | m = ""; 434 | for (d = "string" == typeof r ? r == RSAAPP.NoPadding ? 1 : r == RSAAPP.PKCS1Padding ? 2 : 0 : 0, o = "string" == typeof e && e == RSAAPP.RawEncoding ? 1 : 0, 1 == d ? c > i.chunkSize && (c = i.chunkSize) : 2 == d && c > i.chunkSize - 11 && (c = i.chunkSize - 11), n = 0, g = 2 == d ? c - 1 : i.chunkSize - 1; n < c;) d ? f[g] = t.charCodeAt(n) : f[n] = t.charCodeAt(n), n++, g--; 435 | for (1 == d && (n = 0), g = i.chunkSize - c % i.chunkSize; g > 0;) { 436 | if (2 == d) { 437 | for (a = Math.floor(256 * Math.random()); !a;) a = Math.floor(256 * Math.random()); 438 | f[n] = a 439 | } else f[n] = 0; 440 | n++, g-- 441 | } 442 | for (2 == d && (f[c] = 0, f[i.chunkSize - 2] = 2, f[i.chunkSize - 1] = 0), u = f.length, n = 0; n < u; n += i.chunkSize) { 443 | for (b = new BigInt, g = 0, s = n; s < n + i.chunkSize; ++g) b.digits[g] = f[s++], b.digits[g] += f[s++] << 8; 444 | l = i.barrett.powMod(b, i.e), h = 1 == o ? biToBytes(l) : 16 == i.radix ? biToHex(l) : biToString(l, i.radix), m += h 445 | } 446 | return m 447 | } 448 | function decryptedString(i, t) { 449 | var r, e, n, g, s = t.split(" "), 450 | d = ""; 451 | for (e = 0; e < s.length; ++e) for (g = 16 == i.radix ? biFromHex(s[e]) : biFromString(s[e], i.radix), r = i.barrett.powMod(g, i.d), n = 0; n <= biHighIndex(r); ++n) d += String.fromCharCode(255 & r.digits[n], r.digits[n] >> 8); 452 | return 0 == d.charCodeAt(d.length - 1) && (d = d.substring(0, d.length - 1)), d 453 | } 454 | var biRadixBase = 2, 455 | biRadixBits = 16, 456 | bitsPerDigit = biRadixBits, 457 | biRadix = 65536, 458 | biHalfRadix = biRadix >>> 1, 459 | biRadixSquared = biRadix * biRadix, 460 | maxDigitVal = biRadix - 1, 461 | maxInteger = 9999999999999998, 462 | maxDigits, ZERO_ARRAY, bigZero, bigOne; 463 | setMaxDigits(20); 464 | var dpl10 = 15, 465 | lr10 = biFromNumber(1e15), 466 | hexatrigesimalToChar = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"), 467 | hexToChar = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"), 468 | highBitMasks = new Array(0, 32768, 49152, 57344, 61440, 63488, 64512, 65024, 65280, 65408, 65472, 65504, 65520, 65528, 65532, 65534, 65535), 469 | lowBitMasks = new Array(0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535), 470 | RSAAPP = {}; 471 | RSAAPP.NoPadding = "NoPadding", RSAAPP.PKCS1Padding = "PKCS1Padding", RSAAPP.RawEncoding = "RawEncoding", RSAAPP.NumericEncoding = "NumericEncoding", function() { 472 | function i(i) { 473 | var t = new Image, 474 | r = ""; 475 | for (var e in i) r += "&" + e + "=" + encodeURIComponent(i[e]); 476 | r = "https://wlmonitor.m.jd.com/web_login_report?" + r.substring(1), t.src = r 477 | } 478 | function t(i, r) { 479 | if ("object" == typeof r && null != r) for (var e in r)"object" == typeof r[e] ? (i[e] = r[e].length ? [] : {}, t(i[e], r[e])) : i[e] = r[e] 480 | } 481 | function r(i) { 482 | for (var t = location.search.substring(1), r = t.split("&"), e = {}, n = 0; n < r.length; n++) { 483 | var g = r[n].split("="); 484 | e[g[0]] = g[1] 485 | } 486 | return e[i] ? e[i] : "" 487 | } 488 | function e(i) { 489 | var t = document.cookie.match(new RegExp("(^| )" + i + "=([^;]*)($|;)")); 490 | return t ? decodeURIComponent(t[2]) : "" 491 | } 492 | var n = function(n) { 493 | var g = r("appid"), 494 | s = e("guid"), 495 | d = e("pin"), 496 | o = { 497 | appID: g ? parseInt(g, 10) : 100, 498 | interfaceID: 0, 499 | loginName: "", 500 | uuid: s, 501 | pin: d, 502 | guid: s, 503 | os: "5", 504 | netType: "", 505 | appVersion: "1.3.0", 506 | status: "", 507 | callTime: 0 508 | }; 509 | t(o, n), i(o) 510 | }; 511 | 512 | } 513 | function u(){ 514 | var e = {};var t ="''' + str_rsaString + '''";setMaxDigits(131);var n = new RSAKeyPair("3", "10001", t, 1024),i = base64encode(encryptedString(n,"''' + pwd + '''", RSAAPP.PKCS1Padding, RSAAPP.RawEncoding));return i}''' 515 | 516 | 517 | 518 | ctxt = PyV8.JSContext() 519 | ctxt.enter() 520 | ctxt.eval(decoder(a)) 521 | func = ctxt.locals.u 522 | return func() 523 | -------------------------------------------------------------------------------- /JDPackage/rk.py: -------------------------------------------------------------------------------- 1 | # encoding=utf-8 2 | from PIL import ImageTk 3 | import random 4 | import requests 5 | import hashlib 6 | import os 7 | from .datacontrol import * 8 | 9 | 10 | def fuck_code_rk(rk_um, rk_pwd, imgLocate): 11 | try: 12 | rc = RClient(rk_um, rk_pwd) 13 | im = open(imgLocate, 'rb').read() 14 | t=rc.rk_create(im, 3040)['Result'] 15 | print (t) 16 | return (t) 17 | except Exception as err: 18 | print (err) 19 | raise Exception('Ruokuai Error!') 20 | 21 | class RClient(object): 22 | def __init__(self, username, password): 23 | self.username = username 24 | self.password = hashlib.md5(password.encode(encoding='utf-8')).hexdigest() 25 | self.soft_id = '78829' 26 | self.soft_key = '30dfb059ce40493ea95af20c778ada7c' 27 | self.base_params = { 28 | 'username': self.username, 29 | 'password': self.password, 30 | 'softid': '78829', 31 | 'softkey': '30dfb059ce40493ea95af20c778ada7c', 32 | } 33 | self.headers = { 34 | 'Connection': 'Keep-Alive', 35 | 'Expect': '100-continue', 36 | 'User-Agent': 'ben', 37 | } 38 | 39 | def rk_create(self, im, im_type, timeout=60): 40 | """ 41 | im: 图片字节 42 | im_type: 题目类型 43 | """ 44 | params = { 45 | 'typeid': im_type, 46 | 'timeout': timeout, 47 | } 48 | params.update(self.base_params) 49 | files = {'image': ('a.jpg', im)} 50 | r = requests.post('http://api.ruokuai.com/create.json', data=params, files=files, headers=self.headers) 51 | return r.json() 52 | 53 | def rk_report_error(self, im_id): 54 | """ 55 | im_id:报错题目的ID 56 | """ 57 | params = { 58 | 'id': im_id, 59 | } 60 | params.update(self.base_params) 61 | r = requests.post('http://api.ruokuai.com/reporterror.json', data=params, headers=self.headers) 62 | return r.json() 63 | 64 | 65 | def rk_webdriver_verify(driver,rc,xpath_text): 66 | if os.path.isdir('C:\Temp'): 67 | pass 68 | else: 69 | os.mkdir('C:\Temp') 70 | rdname = str(random.randint(1000000, 10000000)) 71 | driver.maximize_window() 72 | try: 73 | driver.save_screenshot('C:\\temp\\' + rdname + '.jpg') 74 | except: 75 | raise Exception("请确认C:\Temp目录存在!") 76 | try: 77 | imgelement = driver.find_element_by_xpath(xpath_text) 78 | location = imgelement.location 79 | size = imgelement.size 80 | rangle = ( 81 | int(location['x']), int(location['y']), 82 | int(location['x'] + size['width']), 83 | int(location['y'] + size['height'])) 84 | frame4 = ImageTk.Image.open('C:\\temp\\' + rdname + '.jpg').crop(rangle) 85 | frame4.save('C:\\temp\\' + rdname + '.png') 86 | im = open('C:\\temp\\' + rdname + '.png', 'rb').read() 87 | print(decoder('开始识别验证码')), 88 | except: 89 | raise Exception("请确认您安装了正确的Pillow包!") 90 | try: 91 | codex = rc.rk_create(im, 3040)['Result'] 92 | except Exception as err: 93 | print(err) 94 | raise Exception("若快验证码识别出错!") 95 | return codex 96 | 97 | -------------------------------------------------------------------------------- /JDPackage/spider.py: -------------------------------------------------------------------------------- 1 | # encoding=utf8 2 | import threading 3 | import re 4 | import time 5 | import requests 6 | import warnings 7 | import copy 8 | from .datacontrol import * 9 | 10 | warnings.filterwarnings("ignore") 11 | 12 | 13 | class Spider: 14 | def __init__(self, thread_amount): 15 | """Create a JDLotterySpider""" 16 | self.thread_amount = thread_amount 17 | self._headers = { 18 | 'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) ' 19 | 'Chrome/47.0.2526.80 Safari/537.36 Core/1.47.163.400 QQBrowser/9.3.7175.400'} 20 | self._algo = ["lotterycode:'(.*?)'", 'lotterycode=(.*?)"', 'data-code="(.*?)', 'lottNum="(.*?)"'] 21 | # Lotterycode的正则算法,可自行更新(若京东页面更新) 22 | self.browser = requests.session() 23 | self._retry_times = 10 24 | self._pool = [] 25 | self.salelist = [] 26 | self.templist = [] 27 | self.lc_dict = {} 28 | 29 | 30 | def Strawberry(self, filename): 31 | print(len(self._pool)) 32 | """A Spider wrote by author,you can also use this lib to write your own JDSpider""" 33 | self.startpool(self._pool, self.salelist) 34 | print('Wait a while ^v^') 35 | time.sleep(20) 36 | 37 | print('Start') 38 | while len(self._pool) > 0: 39 | print(decoder('剩余网页数:')), 40 | print(len(self._pool)) 41 | time.sleep(1) 42 | self._pool = copy.deepcopy(self.salelist) 43 | self.startpool(self._pool, self.templist) 44 | 45 | while len(self._pool) > 0: 46 | print(decoder('剩余网页数:')), 47 | print(len(self._pool)) 48 | time.sleep(1) 49 | self.templist.extend(self.salelist) 50 | self.templist = list(set(self.templist)) 51 | t = list(set(self.templist) ^ set(self.salelist)) 52 | self.startpool(t, self.templist) 53 | while len(t) > 0: 54 | print(decoder('剩余网页数:')), 55 | print(len(t)) 56 | time.sleep(1) 57 | self.templist = list(set(self.templist)) 58 | self.cf_pool(self.templist) 59 | while len(self.templist) > 0: 60 | print(decoder('剩余网页数:')), 61 | print(len(self.templist)) 62 | time.sleep(1) 63 | spider_file_csv(self.lc_dict, filename) 64 | 65 | def findsale(self, url): 66 | """Search JD-Salepage in webpage""" 67 | spset = [] 68 | for times in range(self._retry_times): 69 | try: 70 | for each in re.findall('sale.jd.com/act/(.*?)' + '.html', 71 | self.browser.get(url, headers=self._headers, timeout=2).text, re.S): 72 | spset.append('http://sale.jd.com/act/' + each + '.html') 73 | return spset 74 | except: 75 | time.sleep(1) 76 | 77 | def findlc(self, salepage): 78 | """Search lotterycode in JD-Salepage""" 79 | result = [] 80 | for times in range(self._retry_times): 81 | try: 82 | for each in self._algo: 83 | for each2 in re.findall(each, self.browser.get(salepage, headers=self._headers, timeout=2).text, 84 | re.S): 85 | self.lc_dict[each2] = salepage 86 | return result 87 | except: 88 | time.sleep(1) 89 | 90 | def runpool(self, pool, to_pool): 91 | while len(pool) > 0: 92 | site = pool[0] 93 | pool.remove(site) 94 | try: 95 | for each in self.findsale(site): 96 | each = each.lower() 97 | to_pool.append(each) 98 | except: 99 | pass 100 | 101 | def startpool(self, pool, to_pool): 102 | for num in range(0, self.thread_amount): 103 | threading.Thread(target=self.runpool, args=(pool, to_pool)).start() 104 | 105 | def cf_pool(self, pool): 106 | for num in range(0, self.thread_amount): 107 | threading.Thread(target=self.codefinding, args=(pool,)).start() 108 | 109 | def codefinding(self, pool): 110 | while len(pool) > 0: 111 | site = pool[0] 112 | pool.remove(site) 113 | self.findlc(site) 114 | 115 | 116 | -------------------------------------------------------------------------------- /JDPackage/spider.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HiddenStrawberry/JDPackage/425c9da98b6d642b0633b79b11442ba84088ace5/JDPackage/spider.pyc -------------------------------------------------------------------------------- /[单线程]领卷模式1示例.py: -------------------------------------------------------------------------------- 1 | # encoding=utf-8 2 | from JDPackage import * 3 | 4 | # DOCS:https://github.com/HiddenStrawberry/JDPackage/blob/master/docs/cookies.md 5 | # DOCS:https://github.com/HiddenStrawberry/JDPackage/blob/master/docs/coupon.md 6 | 7 | 8 | 9 | multi_couponA('#', '#', '#', '#', 1,0.1, #京东账号,京东密码,若快账号,若快密码,线程数,延时 10 | '2017-04-28 23:59:30', #开始时间 11 | '2017-04-30 00:00:30', #结束时间 12 | 'http://coupon.m.jd.com/coupons/show.action?key=88dfb7d340614fd690296ac8634d12e9&roleId=6244957&to=chongzhi.m.jd.com/&cu=true&utm_source=www.zuanke8.com&utm_medium=tuiguang&utm_campaign=t_1000000936_571233&utm_term=ef10cc211a3a4129851e1251b092cbb4&abt=3' 13 | ) # 卷地址 14 | 15 | #注意:账号自动一个一个登陆,请提前运行做好登陆准备 16 | 17 | # 支持输入手机或电脑端优惠券地址, 18 | 19 | # 模式1的抢卷过程:从运行开始就不断尝试抢卷,打码,如此循环。适合京东耍猴不放卷时使用。如线程开的够多密度够大,也适合正常半黑号抢卷使用 20 | 21 | # 建议提前30秒左右就开始运行!如果需要提前测试,输入任何一个早于现在的时间即可!时间格式不可以改变,必须和例子格式相同!) 22 | -------------------------------------------------------------------------------- /[多线程]领卷模式1示例.py: -------------------------------------------------------------------------------- 1 | # encoding=utf-8 2 | from JDPackage import * 3 | 4 | # DOCS:https://github.com/HiddenStrawberry/JDPackage/blob/master/docs/cookies.md 5 | # DOCS:https://github.com/HiddenStrawberry/JDPackage/blob/master/docs/coupon.md 6 | 7 | 8 | 9 | multi_couponA('#', '#', '#', '#', 10,0.1, #京东账号,京东密码,若快账号,若快密码,线程数,延时 10 | '2017-04-28 23:59:30', #开始时间 11 | '2017-04-30 00:00:30', #结束时间 12 | 'http://coupon.m.jd.com/coupons/show.action?key=88dfb7d340614fd690296ac8634d12e9&roleId=6244957&to=chongzhi.m.jd.com/&cu=true&utm_source=www.zuanke8.com&utm_medium=tuiguang&utm_campaign=t_1000000936_571233&utm_term=ef10cc211a3a4129851e1251b092cbb4&abt=3' 13 | ) # 卷地址 14 | 15 | #注意:账号自动一个一个登陆,请提前运行做好登陆准备 16 | 17 | # 支持输入手机或电脑端优惠券地址, 18 | 19 | # 模式1的抢卷过程:从运行开始就不断尝试抢卷,打码,如此循环。适合京东耍猴不放卷时使用。如线程开的够多密度够大,也适合正常半黑号抢卷使用 20 | 21 | # 建议提前30秒左右就开始运行!如果需要提前测试,输入任何一个早于现在的时间即可!时间格式不可以改变,必须和例子格式相同!) 22 | -------------------------------------------------------------------------------- /cookies.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HiddenStrawberry/JDPackage/425c9da98b6d642b0633b79b11442ba84088ace5/cookies.csv -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | 京东全能工具包 JDPackage V2.3 2 | =================== 3 | 4 | ## 作者2018.8.27留 5 | 6 | 感谢大家对我的支持,虽然项目停止更新了还是在给我点star...多谢大家 7 | 8 | 这是我在大三下完成的一整套脚本,现在来看代码风格可能不是那么严谨,也不是很Pythonic,但是这套代码的确让我的大学过得很舒服。 9 | 10 | 现在已经毕业了,工作还不错,几年来要感谢京东成就了我很多,现在我已经不薅羊毛了,安心在京东上消费hhh 11 | 12 | 重写是不太可能重写了,京东已经上了滑动验证,有兴趣的可以自己改写下相关的部分,祝大家学的开心 13 | 14 | 作者已停止更新!部分功能可能不可用,欢迎修复问题commit发pr给我,我觉得可以就合并进来! 15 | 16 | ![python](https://img.shields.io/badge/language-python-orange.svg) 17 | 18 | ![此处输入图片的描述][1] 19 | 20 | 特性: 21 | --- 22 | 23 | 1. 丰富的可扩展性:丰富的文档帮助你借助本程序二次开发出个性化的程序。 24 | 2. 同时兼容Python2/3:无需考虑兼容性问题。 25 | 3. 轻量化:仅依赖3个第三方包(requests,pillow4.0.0,selenium2.53.0) 26 | 4. 全自动:全自动定时抢卷/抽奖功能,并支持多线程,配置有多高,速度就有多快。 27 | 5. 对新手友好:大量的示例,即便不会Python也能快速构建环境。 28 | 目前已经实现的功能: 29 | ---------- 30 | 各文件开发文档地址:https://github.com/HiddenStrawberry/JDPackage/wiki 31 | 32 | 1. Spider.py #京东抽奖LotteryCode爬虫 33 | 34 | - 京东抽奖代码爬虫 35 | 36 | 2. Lotterypack.py #京东抽奖工具包 37 | 38 | - 支持代理IP的定时抽奖工具 39 | - kuaidaili.com免费代理IP获取+过滤有效IP工具 40 | - Lotterycode测水工具 41 | 42 | 3. account.py #京东账户信息管理工具包 43 | 44 | - 浏览器Cookies载入(只要有一段Cookie,就可以在Firefox实现直接登录而无需账号/密码,可以跳过手机验证及风险验证) 45 | - 电脑端及M端登录 46 | - 获取优惠券列表 47 | - 获取消息列表 48 | - 获取订单列表 49 | 50 | 4. datacontrol.py #文件及数据库处理 51 | - Python2/3兼容性处理 52 | - CSV文件读写 53 | 54 | 5. rk.py #若快打码组件 55 | 56 | 6. coupon.py # 京东优惠券工具包 57 | - M端/电脑端优惠券领取 58 | - 获取a.jd.com领卷中心的任意页面的任意优惠券领取地址 59 | - 领取a.jd.com领卷中心任意优惠券 60 | 61 | 7. mlogin.py #京东M端登陆模拟执行 62 | 63 | 8. JDEncrypt.html #京东PC端登陆模拟执行 64 | 65 | 66 | 所有功能都有对应的极为详尽的由作者煞费苦心写的文档及具体的使用例子,可以到docs目录中查看各个文件的文档,新手请参阅[新手教程][2]。 67 | 68 | 使用方法: 69 | 70 | from JDPackage import * 71 | 72 | ---------- 73 | 74 | 说明 75 | -- 76 | - 本工具包持续更新 77 | - 程序仅供您研究使用,严禁用于非法用途,因程序产生的一切问题与源码作者无关 78 | 79 | 80 | 81 | ---------- 82 | 83 | 作者QQ:1317171753,学习群:108934299 84 | --------------- 85 | 86 | 87 | [1]: https://www.gnu.org/graphics/gplv3-127x51.png 88 | [2]: https://github.com/HiddenStrawberry/JDPackage/wiki/%E6%96%B0%E6%89%8B%E6%95%99%E7%A8%8B 89 | -------------------------------------------------------------------------------- /循环测水示例.py: -------------------------------------------------------------------------------- 1 | #encoding=utf-8 2 | from JDPackage import * 3 | import time 4 | #DOCS : https://github.com/HiddenStrawberry/JDPackage/blob/master/docs/lotterypack.md 5 | 6 | while 1==1: 7 | time.sleep(1) 8 | testwater('d2d7f4a5-adb7-41c5-96ce-ba923ea88eba') #输出某代码最近的出奖时间 9 | -------------------------------------------------------------------------------- /批量抽奖预约.py: -------------------------------------------------------------------------------- 1 | #encoding=utf8 2 | from JDPackage import * 3 | 4 | #DOCS : https://github.com/HiddenStrawberry/JDPackage/blob/master/docs/account.md 5 | 6 | yuyue(1,'http://yushou.jd.com/toYuyue.action?sku=4099139&key=89887ab4e1a4e8408518a39b53062764') 7 | # userid,预约链接 -------------------------------------------------------------------------------- /批量评价示例.py: -------------------------------------------------------------------------------- 1 | #encoding=utf8 2 | from JDPackage import * 3 | t=Account('#','#','#','#') 4 | t.login_pc() 5 | t.comment() 6 | -------------------------------------------------------------------------------- /抽奖代码爬虫示例.py: -------------------------------------------------------------------------------- 1 | #encoding=utf-8 2 | from JDPackage import * 3 | #DOCS : https://github.com/HiddenStrawberry/JDPackage/blob/master/docs/spider.md 4 | 5 | #运行爬虫 6 | t=Spider(100) #新建一个JDLottery爬虫,线程数为20 7 | 8 | # -- 加载地址到爬虫中 -- 9 | rows = loadCSVfile('3.csv') 10 | for each in rows: 11 | t._pool.append(each[0]) # _pool为需要爬取的地址池 12 | 13 | ''' 14 | #1.csv包含14万京东店铺地址,如有需要请联系作者QQ付费使用。15RMB/1 File,若您已经购买,请去掉这段注释 15 | rows = loadCSVfile('1.csv') 16 | for each in rows: 17 | t._pool.append(each[0]) 18 | ''' 19 | # -- 加载完毕 -- 20 | t.Strawberry('code.txt') #使用作者所写的爬取方法进行爬取,会生成文件名为code.txt的代码字典 21 | 22 | #读取代码: 23 | read_lotteryfile('code.txt') #输出抽奖代码具体内容 24 | -------------------------------------------------------------------------------- /抽奖实例(不带代理).py: -------------------------------------------------------------------------------- 1 | #encoding=utf-8 2 | from JDPackage import * 3 | 4 | #DOCS:https://github.com/HiddenStrawberry/JDPackage/blob/master/docs/lotterypack.md 5 | lottery_login('#','#','#','#',1) 6 | 7 | #登陆京东账号,设定userid为1(userid用来分组),并将cookies存入cookies文件(注意:每个帐号登录只需要一次,除非cookies失效) 8 | 9 | 10 | add_lottery('1', '4b6c385f-a626-48d2-8abe-f2ce2ebe5d5f', '2017-03-08 20:57:30', 5) 11 | add_lottery('2', '4b6c385f-a626-48d2-8abe-f2ce2ebe5d5f', '2017-03-08 20:57:30', 5) 12 | # userid, 抽奖码, 开始时间, 两账号抽奖延迟 13 | -------------------------------------------------------------------------------- /抽奖实例(带代理).py: -------------------------------------------------------------------------------- 1 | #encoding=utf-8 2 | 3 | from JDPackage import * 4 | 5 | #DOCS:https://github.com/HiddenStrawberry/JDPackage/blob/master/docs/lotterypack.md 6 | 7 | lottery_login('#','#','#','#',1) 8 | lottery_login('#','#','#','#',1) 9 | lottery_login('#','#','#','#',1) 10 | lottery_login('#','#','#','#',2) 11 | #登陆京东账号,设定userid为1(userid用来分组),并将cookies存入cookies文件(注意:每个帐号登录只需要一次,除非cookies失效) 12 | 13 | 14 | 15 | get_iplist('ip.csv', 10,'inha') #此处参数参见文档,无特殊需求勿动 16 | filter_iplist('ip.csv', 'new.csv', 2) #此处参数参见文档,无特殊需求勿动 17 | 18 | 19 | add_lottery(1, '4b6c385f-a626-48d2-8abe-f2ce2ebe5d5f', '2017-03-08 20:57:30', 5, loadCSVfile('new.csv')) 20 | add_lottery(2, '4b6c385f-a626-48d2-8abe-f2ce2ebe5d5f', '2017-03-08 20:57:30', 5, loadCSVfile('new.csv')) 21 | # userid, 抽奖码, 开始时间, 两账号抽奖延迟 -------------------------------------------------------------------------------- /浏览器载入Cookies.py: -------------------------------------------------------------------------------- 1 | #encoding=utf-8 2 | from JDPackage import * 3 | 4 | browser('url',cookies='') 5 | #目前仅支持Firefox 47.0以下的版本!请先安装一个Firefox 6 | 7 | #此功能为高级功能,目前稳定性暂时比较差,如失败请重试 8 | #如果是Fiddler之类抓的Cookies,参数写成cookies='xxx(cookies内容)'即可 9 | #如果有cookies字典,参数写成cookie_dictionary=xxx即可。 10 | -------------------------------------------------------------------------------- /账户信息查询.py: -------------------------------------------------------------------------------- 1 | #encoding=utf8 2 | from JDPackage import * 3 | 4 | #DOCS : https://github.com/HiddenStrawberry/JDPackage/blob/master/docs/account.md 5 | 6 | a=Account('#', '#', '#', '#') #新建账号a 7 | a.login_pc() #账号PC端登录 8 | a.login() #账号M端登录 9 | 10 | a.get_couponlist() #获取优惠券列表 11 | a.get_msglist() #获取消息列表 12 | a.get_payment() #获取订单列表 13 | 14 | b=Account('#', '#', '#', '#') #新建账号b 15 | b.login_pc() #账号PC端登录 16 | b.login() #账号M端登录 17 | 18 | b.get_couponlist() #获取优惠券列表 19 | b.get_msglist() #获取消息列表 20 | b.get_payment() #获取订单列表 21 | -------------------------------------------------------------------------------- /遍历所有抽奖代码抽奖.py: -------------------------------------------------------------------------------- 1 | # encoding=utf8 2 | from JDPackage import * 3 | import datetime 4 | print datetime.datetime.now() 5 | 6 | 7 | # lottery_login('#','#','#','#',1) #登录 8 | time = datetime.datetime.strptime('2017-03-08 20:57:30', '%Y-%m-%d %H:%M:%S') #设置初始时间 9 | dc = dict(eval(open('code.txt', 'rb').read())) #读取代码字典 10 | for k, value in dc.items(): 11 | time = time + datetime.timedelta(seconds=5) #设置间隔时间秒数 12 | add_lottery(1, k, str(time), 5) #增加抽奖线程 -------------------------------------------------------------------------------- /领取a.jd.com优惠券示例.py: -------------------------------------------------------------------------------- 1 | #encoding=utf-8 2 | from JDPackage import * 3 | 4 | #DOCS : https://github.com/HiddenStrawberry/JDPackage/blob/master/docs/coupon.md 5 | 6 | 7 | get_ajd_list('http://a.jd.com/coupons.html?page=3') #获取优惠卷列表 8 | # 优惠券列表地址 9 | 10 | 11 | 12 | a = Coupon('#', '#', '#', '#') 13 | # 京东账号 京东密码 若快账号 若快密码 14 | 15 | 16 | a.login_pc() #账号PC端登录 17 | 18 | 19 | a.get_ajd_coupon('http://a.jd.com/ajax/freeGetCoupon.html?key=f8d0c71b6a4607a435340fb45cec002660d4259919d9d32026976effd53bb7dbb6c0cd979127aa34d4664d7e12339de1&r=0.7308938041372057', 20 | '2017-04-17 20:00:00') 21 | # 优惠券链接, 22 | # 开始领取的时间 23 | 24 | 25 | a.get_couponlist() #查询当前优惠卷列表 26 | --------------------------------------------------------------------------------