def getDomainBaiduLss(): try: domainsDown = json.loads( http.getter( "http://alpha.elmeast.com.cn/api/calledForlikun/getplayDomain.php", "")) domainsUp = http.getter( "http://alpha.elmeast.com.cn/api/calledForlikun/getpushDomain.php", "") for d in json.loads(domainsUp): domainsDown.append(d) r_cache.set("baiduLssAllDomain", domainsDown) return domainsDown except: logger.error("getBaiduLssAllDomain ERROR:" + str(sys.exc_info())) return json.loads(r_cache.get("baiduLssAllDomain"))
def getMdnAccountId(): try: return json.loads( http.getter( "http://alpha.elmeast.com.cn/api/calledForlikun/getAccountID_mdn.php", p={})) except: logger.error("getMdnAccountId ERROR:" + str(sys.exc_info()))
def getDomainsBySP(sp="elmeast"): try: domains = http.getter( "http://alpha.elmeast.com.cn/api/calledForlikun/getDomains.php", {"sp": sp}) r_cache.set(sp + "domains", domains) return domains except: logger.error("getDomainsBySP ERROR:" + str(sys.exc_info())) return r_cache.get(sp + "domains")
def getKingDomain(domainid): try: domain = http.getter( "http://alpha.elmeast.com.cn/api/calledForlikun/getDomainByKingId.php", {"domainid": domainid}) r_cache.set(domainid, domain) return domain except: logger.error("getKingDomain ERROR:" + str(sys.exc_info())) return r_cache.get(domainid)
def getUdnAccountID(): try: AccountIDs = http.getter( "http://alpha.elmeast.com.cn/api/calledForlikun/getUdnAcountID.php", {}) r_cache.set("UDN", AccountIDs) return json.loads(AccountIDs) except: logger.error("getUdnAccountID ERROR:" + str(sys.exc_info())) return json.loads(r_cache.get("UDN"))
def is_chinatelecom_domain(domain): cache_key = "isctdoamin:{}".format(domain) url = "http://alpha.elmeast.com.cn/api/calledForlikun/IsTeleChannel.php" res = http.getter(url, {"domain": domain}) if res is not None: r_cache.setex(cache_key, 3600, res) else: res = r_cache.get(cache_key) if res is None: return False return json.loads(res)["isTele"]
def getUsernameByDomain(domain): try: username = http.getter( "http://alpha.elmeast.com.cn/api/calledForlikun/getUsernameByDomainV2.php", { "domain": domain, "sp": "elmeast" }) r_cache.set(domain + "username", username) return username except: logger.error("getUsernameByDomain ERROR:" + str(sys.exc_info())) return r_cache.get(domain + "username")
def getDomainsThree(): try: username = config.get("ThreeUser", "name") domains = [] for user in username.split(","): d = http.getter( "http://alpha.elmeast.com.cn/api/calledForlikun/getDomainByAccount.php", {"account": user}) domains += json.loads(d) r_cache.set("domains", json.dumps(domains)) return json.dumps(domains) except: logger.error("getDomainsBySP ERROR:" + str(sys.exc_info())) return r_cache.get("domains")
def getUpDomain(cdn, tp): try: domains = http.getter( "http://alpha.elmeast.com.cn/api/calledForlikun/getpushDomain.php", "") ds = json.loads(domains) for i in ds: if i is None: ds.remove(i) r_cache.set('baiduLssUpDomain', json.dumps(ds)) return ds except: logger.error("getBaiduLssUpDomain ERROR:" + str(sys.exc_info())) return json.loads(r_cache.get('baiduLssUpDomain'))
def getDomain(cdn): try: domains = http.getter( "http://alpha.elmeast.com.cn/api/calledForlikun/getDomainBycdnV2.php", { "cdn": cdn, "sp": "elmeast" }) ds = json.loads(domains) for i in ds: if i is None: ds.remove(i) r_cache.set("_".join([cdn, "elmeast"]), json.dumps(ds)) return ds except: logger.error("getDomain ERROR:" + str(sys.exc_info())) return json.loads(r_cache.get("_".join([cdn, "elmeast"])))