diff --git a/mission.py b/mission.py index fd5addf..e04c074 100644 --- a/mission.py +++ b/mission.py @@ -4,19 +4,21 @@ import requests import re import sys +import time + from config import username, password reload(sys) sys.setdefaultencoding('utf-8') -index_url = "http://www.v2ex.com" -login_url = "http://www.v2ex.com/signin" -daily_url = "http://www.v2ex.com/mission/daily" +index_url = "https://www.v2ex.com" +login_url = "https://www.v2ex.com/signin" +daily_url = "https://www.v2ex.com/mission/daily" headers = { - "User-Agent": "UA", - "Host": "v2ex.com", - "Origin": "http://v2ex.com", - "Referer": "http://www.v2ex.com/signin" + "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36", + "Host": "www.v2ex.com", + "Origin": "https://www.v2ex.com", + "Referer": "https://www.v2ex.com/signin" } s = requests.Session() @@ -48,21 +50,29 @@ def trim(s): return s.strip() -def get_once_value(): +def get_once_tokens(): once_value = '' + once_user_token = '' + once_password_token = '' + login_page = s.get(login_url, headers=headers, verify=False).text once_value = extract(login_page, '') - return once_value + once_user_token = extract(login_page, '