爱意满满的作品展示区。
m939594960

简单的写了一个饿了么满减的爬虫

  •  
  •   m939594960 · May 16, 2018 · 5788 views
    This topic created in 2931 days ago, the information mentioned may be changed or developed.

    代码很烂.流水账,但是应该可以凑合用.

    https://gist.github.com/hooklife/b416c326e1ea726b38003f44b9109ed0

    使用方法,电脑端打开饿了么,选好地址后,

    https://www.ele.me/place/{geohash}?latitude={latitude}&longitude={longitude} 获取 url 中 geohash,latitude,longitude 并修改程序中变量

    登录账号后获取 cookies 中的 SID,USERID,ubt_ssid 并替换程序中对应位置(大概 24 行)

    修改数据库链接账号密码

    然后即可运行

    mysql 创建表语句

    CREATE TABLE `activities` (
      `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `name` varchar(255) DEFAULT NULL,
      `tips` varchar(255) DEFAULT NULL,
      `buy` int(5) unsigned DEFAULT '0',
      `discount` double(5,1) DEFAULT '0.0',
      `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
    
    

    几个查优惠的语句

    # 查询可以用 35-6 红包的最合适的店家
    select *,(buy-discount)/buy as q,(buy-discount-6) as b from activities where buy >=35 order by b asc 
    # 查询全减的商家
    select * from activities where discount=buy order by buy desc 
    
    6 replies    2018-05-17 09:09:56 +08:00
    kevindu
        1
    kevindu  
       May 16, 2018
    嗯 很烂
    vtwoextb
        2
    vtwoextb  
       May 16, 2018
    嗯 很烂
    codelover2016
        3
    codelover2016  
       May 16, 2018
    那个...
    确实是很一般.
    m939594960
        4
    m939594960  
    OP
       May 16, 2018
    @kevindu
    @vtwoextb
    @codelover2016
    哈哈...能用就行了,要啥自行车.....
    oneyian
        5
    oneyian  
       May 17, 2018
    不挺好的吗。但是进不去了
    m939594960
        6
    m939594960  
    OP
       May 17, 2018
    @oneyian 什么进不去了?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3195 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 75ms · UTC 14:07 · PVG 22:07 · LAX 07:07 · JFK 10:07
    ♥ Do have faith in what you're doing.