import time
from urllib.parse import parse_qs
import requests
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.common.exceptions import *
from selenium.webdriver.support.wait import WebDriverWait
# 额外抽取的授权模块
from utils import auth
class QMM(object):
"""借助券妈妈平台褥京东京豆"""
def __init__(self, sleep=3, months=None, days=None):
self.timeout, self.months, self.days = sleep, None, None
# 爬取规则
if months:
month_interval = months.split('-')
start_month, end_month = int(month_interval[0]), int(month_interval[-1])
self.months = list(map(lambda m: '{}月'.format(m), range(start_month, end_month + 1)))
if days:
day_interval = days.split('-')
start_day, end_day = int(day_interval[0]), int(day_interval[-1])
self.days = list(map(lambda d: '{}日'.format(d), range(start_day, end_day + 1)))
# 手机店铺(用作提醒输出,可复制链接到手机端领取)
self.m_shop = []
# 统计京豆总数
self.jing_dou = 0
def _crawl_url(self):
""" 抓取京豆更新页, 获得店铺京豆领取地址"""
# 日期更新页
<