def __init__(self, text): h = header.Headers() self.headers = h.get_headers(text) self.data = { 'source': 'pc', 'weather_type': 'observe|forecast_1h|forecast_24h|index|alarm|limit|tips|rise', 'province': '广东', 'city': '广州', 'county': '番禺区', } self.url = 'https://wis.qq.com/weather/common?source=pc&weather_type=observe%7Cforecast_1h%7Cforecast_24h%7Cindex%7Calarm%7Climit%7Ctips%7Crise' \ '&province={}&city={}&county={}'.format(self.data['province'],self.data['city'],self.data['county'])
def __init__(self, text): # 构造请求头 self.headers = header.Headers().get_headers(text)
print(response.text) f.write('password为: %s' % str(password)) f.write('\n') f.write('flag的信息如下:\n') f.write(response.text) return password return -1 if __name__ == '__main__': dfs() text = """ Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3 Accept-Encoding: gzip, deflate Accept-Language: zh-CN,zh;q=0.9 Cache-Control: max-age=0 Connection: keep-alive Content-Length: 10 Content-Type: application/x-www-form-urlencoded Cookie: OUTFOX_SEARCH_USER_ID_NCOO=1047596894.6190807 Host: 123.206.87.240:8002 Origin: http://123.206.87.240:8002 Referer: http://123.206.87.240:8002/baopo/?yes Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.90 Safari/537.36 """ h = header.Headers() headers = h.get_headers(text) url = 'http://123.206.87.240:8002/baopo/?yes' get_password(url, headers)
chapter_html = chapter_html.text #print(chapter_html) chapter_content = re.findall(r'<div class="p">(.*?)<p></p>', chapter_html, re.S)[0] chapter_content = re.findall('<p>(.*?)</p>', chapter_content, re.S) # print(title) # for item in chapter_content: # print(item) format_write(title, chapter_content) break if __name__ == '__main__': text = """ accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3 accept-encoding: gzip, deflate, br accept-language: zh-CN,zh;q=0.9 cache-control: max-age=0 cookie: GUID=f6597cb6-25cd-43d5-96c8-eb2ea99dfa4d; UM_distinctid=16cddcec2482d7-04aeefb6e74675-37c143e-144000-16cddcec2494d4; OUTFOX_SEARCH_USER_ID_NCOO=818054790.6546456; sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%22f6597cb6-25cd-43d5-96c8-eb2ea99dfa4d%22%2C%22%24device_id%22%3A%2216cddcec123373-0c4abeac302c3-37c143e-1327104-16cddcec124238%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E8%87%AA%E7%84%B6%E6%90%9C%E7%B4%A2%E6%B5%81%E9%87%8F%22%2C%22%24latest_referrer%22%3A%22https%3A%2F%2Fwww.baidu.com%2Flink%22%2C%22%24latest_referrer_host%22%3A%22www.baidu.com%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC%22%7D%7D; CNZZDATA5647345=cnzz_eid%3D1744002380-1567087340-https%253A%252F%252Fwww.baidu.com%252F%26ntime%3D1571621102; Hm_lvt_9793f42b498361373512340937deb2a0=1571624102; Hm_lpvt_9793f42b498361373512340937deb2a0=1571624124 upgrade-insecure-requests: 1 user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.90 Safari/537.36 """ headers = header.Headers().get_headers(text) url = 'https://www.17k.com/list/3039605.html' response = requests.get(url, headers) response.encoding = 'utf-8' response = response.text # print(response) lst = get_chapter(response) download_chapter(lst, headers)