1 Star 32 Fork 17

安东·万科 / JDBrandMember

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

京东入会领京豆

要求

  1. 有一定的电脑知识 or 有耐心爱折腾
  2. 需要Chrome(推荐)
  3. 操作系统需是 Mac(@zc-nju-med在m1上测试正常)、Linux(在deepin上测试过)、Windows

安装方法

脚本采用Selenium遍历京东入会有礼界面,由于遍历了20000+个店铺,可能所需要的时间比较长(视电脑情况30min-5h)

  1. 克隆到本地

    git clone https://github.com/AntonVanke/JDBrandMember.git
  2. 安装所需要的包

    pip3 install -r requirements.txt
  3. 下载对应的浏览器驱动放到项目的drivers文件夹下面

    1. chrome请访问chrome://version/查看浏览器的版本,然后去ChromeDriver Mirror (taobao.org)下载对应的版本/系统驱动

      /drivers/目录默认的驱动是chromedriver(如下),其它需要替换

      Google Chrome 90.0.4430.212 (正式版本) (x86_64)
      操作系统 macOS 版本11.4(版号20F5055c)

      例如 https://npm.taobao.org/mirrors/chromedriver/90.0.4430.24/,不要下载成了LATEST_RELEASE_*开头的文件了案例

    2. 由于增加了兼容性,所以代码默认不提供Edge(Chromium)Firefox。如果你想要运行在这些浏览器上请修改get_browser函数并在下面的网站获取驱动:

      1. edge请访问edge://version/查看浏览器的版本,Microsoft Edge - Webdriver (windows.net)下载
      2. Firefox请访问Releases · mozilla/geckodriver (github.com)下载

运行

如果你以上步骤执行的没有错误的话,你的文件下会有这些文件:

-JDBrandMember
|
|- drivers
|	|- chromedriver
|
|- main.py
|- shopid.txt
|
|- requirements.txt
|- README.md & LICENSE
首次运行
  1. 运行python3 main.py,如果没有报错的话,会弹出浏览器页面,此时需要你登录京东

  2. 运行之后输入3退出,这时你会看到生成了logs文件夹和config.json

    {
        "thread": 6,  # 运行的线程数
        "binary": "",  # 如果驱动没有找到浏览器的话,需要手动配置路径
        "headless": true,  # 是否开启无头模式?建议打开
        "useUser": 0,  # 使用的用户: 0 表示所有、1 代表第 1 个,以此类推
        "threshold": 0,  # 最小京豆数量,小于此的不会入会
        "is_get_voucher": false,  # 是否获取红包,因为红包的有有效期,所以暂时不用的不要开启
        "users": []  # 用户列表
    }
配置

按照上面的配置你的config.json, 执行python3 main.py,等待执行完毕即可,你可以访问项目下的logs/jdbm.log查看你的日志

注意

不要泄露你的config.json

退出时请使用Ctrl+C输入 3 退出,否则可能本次运行的结果不会保存, 并且可能会遗留大部分线程 Issue #23

较上次更新的内容

  1. 京豆阈值( Issue #23 Issue #13)

  2. 多账号执行(Issue #20)

  3. 突然发现还能领红包??

    红包

LICENSE

MIT License

Copyright (c) 2021 Vanke Anton

MIT License Copyright (c) 2021 Vanke Anton Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

京东自动入会获取京豆 展开 收起
Python
MIT
取消

贡献者

全部

近期动态

加载更多
不能加载更多了
Python
1
https://gitee.com/liio/JDBrandMember.git
git@gitee.com:liio/JDBrandMember.git
liio
JDBrandMember
JDBrandMember
main

搜索帮助