def main(debug=list()): result = list() # Specified functions for requesting servers websites = [ request_iss, request_freess_cx, request_nobey, request_5752me, ] from app.config import url websites.extend([(i, None) for i in url]) websites.extend([(i, fake_ua, i[-1]) for i in request_doub_url()]) for website in websites: try: if type(website) is tuple: data, info = request_url(*website) else: data, info = website() result.append({'data': gen_uri(data), 'info': info}) except Exception as e: logging.exception(e, stack_info=False) print('Error in', website, type(website)) # check ssr configs if 'no_validate' in debug: validated_servers = result else: validated_servers = validate(result) # remove useless data servers = list(filter(lambda x: len(x['data']) > 0, validated_servers)) print('-' * 10, '数据获取完毕', '-' * 10) return servers
def test4(): data = ss_free.main(debug=['no_validate']) data = ssr_check.validate(data) for i in data: print(i['info']) for j in i['data']: print(j['status'])