26 lines
660 B
Python
26 lines
660 B
Python
# -*- coding: utf-8 -*-
|
|
import requests
|
|
import logging
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
class Mp2shushu():
|
|
def __init__(self, channel, gameid):
|
|
self.mp_url = f"https://mp.kingsome.cn/api/open/promotion/co-list?channelid={channel}&gameid={gameid}"
|
|
|
|
def get_ad_list(self):
|
|
r = requests.get(self.mp_url)
|
|
if r.status_code == requests.codes.ok:
|
|
return r.json()
|
|
else:
|
|
return None
|
|
|
|
def split_data(self, data):
|
|
try:
|
|
result = data['result']
|
|
except Exception:
|
|
log.error(f"split {data} failed!", exc_info=True)
|
|
result = None
|
|
return result
|