Code Monkey home page Code Monkey logo

ticket-damai's Introduction

pick-ticket-damai

大麦捡漏/pyppeteer/aiohttp 仅供参考,学习

  • 配置:下载谷歌浏览器,安装后在浏览器地址栏输入chrome://version复制"可执行文件路径",终端启动浏览器并登录:
    C:\Users\chrome.exe --remote-debugging-port=9222 --user-data-dir="D:\Test"
    可执行文件路径                             默认端口                自定义文件夹
  • 选票:可在项目(damai)同级或用户根目录添加"config.yaml", 详解见damai.configs.default_configs.py
  • 运行:python run.py

pyppeteer模拟购票

  • 详见damai.init,damai.configs.default_configs

aiohttp请求购票

  • 新仓库中优化了api请求submit的逻辑,之前不会正确退出,可删,可完全使用此仓库。
  • 详见damai.init,damai.configs.default_configs
  • example3,可自定义购票逻辑。
    import asyncio
    
    from loguru import logger
    
    from damai.performer import ApiFetchPerform
    from damai.utils import make_ticket_data
    
    POLL = 2
    COUNT = 2
    
    
    class Gather(ApiFetchPerform):
    
        async def submit(self, item_id, sku_id, tickets):
            for _ in range(POLL):
                tasks = [self._submit(item_id, sku_id, tickets) for _ in range(COUNT)]
                await asyncio.gather(*tasks)
            await super().submit(item_id, sku_id, tickets)
    
        async def _submit(self, item_id, sku_id, tickets):
            crate_response = {}
            try:
                build_response = await self.build_order(f'{item_id}_{tickets}_{sku_id}')
                data = build_response.get("data")
                if data:
                    data = make_ticket_data(data)
                    crate_response = await self.create_order(data)
            except Exception as e:
                logger.info(f'{type(e)} {e}')
            else:
                logger.info(f'生成:{build_response.get("ret")}')
                logger.info(f'创建:{crate_response.get("ret")}')

ps

  • 提前登录, 提前在大麦app中添加观演人及收货地址电话。

待更新

  • 选票字段类存储,易阅读代码,整数选票/日期选票
  • 多档次选择
  • gui写的不怎么好,难以阅读,大佬可按签名编写

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.