# -*- coding: utf-8 -*- import requests,os,datetime HOST = 'https://mgr.aiacademy.tw/' BACK_DOOR='door_key=sadfoiweuSLKJKLIOSFewS12148978090232lajslf' ary_cached_url = [] ary_urls = ['/','/mgr/'] ABS_PATH = os.path.dirname(os.path.realpath(__file__)) + '/' for v in ary_urls: url = v if url=='/': url = '' filename = 'index' else: #Remove slashes from the beginning and end. if url[0:1]=='/': url = url[1:] if url[-1]=='/': url = url[0:-1] filename = url.replace('/','---') print v, url URL = HOST + url +'?nc' res = requests.get(URL); if res.status_code!=200: continue; with open(ABS_PATH + filename, 'w') as f: f.write(res.text.encode(res.encoding)) with open(ABS_PATH + '__LASTEST_RUN_TIME__.txt', 'w') as f: f.write(str(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')));