|
37 | 37 | RE_PHONE_PREFIX = re.compile(r'label ta_r">\+(.*?)<') |
38 | 38 | RE_PHONE_POSTFIX = re.compile(r'phone_postfix">.*?(\d+).*?<') |
39 | 39 |
|
40 | | -DEFAULT_USERAGENT = 'Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0' |
| 40 | +DEFAULT_USERAGENT = 'Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0' |
41 | 41 |
|
42 | 42 | DEFAULT_USER_SCOPE = sum(VkUserPermissions) |
43 | 43 |
|
@@ -248,9 +248,11 @@ def _vk_login(self, captcha_sid=None, captcha_key=None): |
248 | 248 | self.http.cookies.clear() |
249 | 249 |
|
250 | 250 | # Get cookies |
251 | | - response = self.http.get('https://vk.com/') |
| 251 | + response = self.http.get('https://vk.com/login') |
252 | 252 |
|
253 | 253 | headers = { |
| 254 | + 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', |
| 255 | + 'Accept-Language': 'en-US,en;q=0.5', |
254 | 256 | 'Referer': 'https://vk.com/', |
255 | 257 | 'Content-Type': 'application/x-www-form-urlencoded', |
256 | 258 | 'Origin': 'https://vk.com', |
@@ -358,7 +360,7 @@ def _pass_twofactor(self, auth_response): |
358 | 360 |
|
359 | 361 | if status == '4': # OK |
360 | 362 | path = json.loads(data['payload'][1][0]) |
361 | | - return self.http.get('https://vk.com' + path) |
| 363 | + return self.http.get(path) |
362 | 364 |
|
363 | 365 | elif status in [0, '8']: # Incorrect code |
364 | 366 | return self._pass_twofactor(auth_response) |
|
0 commit comments