iOS 下架监控通知
2019-09-02
yu
1 minute read

TL:DR

iOS 下架通知

安装 Bark

iOS 用户 安装 Bark

美区请搜索 bark push

替换下面代码里的 Push URL 部署即可

#!/usr/bin/env python
import requests
import bs4
import datetime

# 日期
def getYesterday(): 
    yesterday = datetime.date.today()
    return yesterday

def getYYesterday(): 
    yesterday = datetime.date.today() + datetime.timedelta(-1)
    return yesterday

def getYYYesterday(): 
    yesterday = datetime.date.today() + datetime.timedelta(-2)
    return yesterday

# 最近三天商店下架应用数
root_url = 'https://www.chandashi.com'
today_url = root_url + '/bang/delist/'
yesterday_url = root_url + '/bang/delist/genre/0/date/'+ str(getYesterday()) +'.html'
yyesterday_url = root_url + '/bang/delist/genre/0/date/'+ str(getYYesterday()) +'.html'
yyyesterday_url = root_url + '/bang/delist/genre/0/date/'+ str(getYYYesterday()) +'.html'
push_url = 'https://[Push URL]/'

def zuori():
    response = requests.get(yesterday_url)
    soup = bs4.BeautifulSoup(response.text,'html.parser')
    soupzhi = soup.select('.cds-filter-row > span')
    return soupzhi

def zzuori():
    response = requests.get(yyesterday_url)
    soup = bs4.BeautifulSoup(response.text,'html.parser')
    return soup.select('.cds-filter-row > span')

def zzzuori():
    response = requests.get(yyyesterday_url)
    soup = bs4.BeautifulSoup(response.text,'html.parser')
    return soup.select('.cds-filter-row > span')

content = push_url + str(getYesterday()) + '下架: ' + str((zuori()[0])) + ' | ' + str(getYYesterday()) + '下架: ' + str((zzuori()[0])) + ' | ' + str(getYYYesterday()) + '下架: ' + str((zzzuori()[0]))
content = content.replace('<span style="margin: 0 3px;">', '')
content = content.replace('</span>', '')
# 显示结果
# print(content)

# crontab -e
# 0 21 * * * python3 /appstore_3day1.py
push = requests.get(content)

关于 Bark 的说明

什么是 Bark

Bark 服务端部署

嫌麻烦可以使用作者提供的公共服务器,安装后开箱即用