Question to reduce links through vk.cc, I suspect that I missed something, in response I get: '3975786006921<!>profile.css,page.css,profile.js,page.js<!>0<!>6762<!>8<!>Невозможно сократить эту ссылку.<!><!>57500570' To any address. The API does not seem to be; I didn’t have an extension for Chrome, I don’t know if it works now, the code is below:
import requests import re def get_form_action(html): form_action = re.findall(r'<form(?= ).* action="(.+)"', html) if form_action: return form_action[0] auth_session = requests.Session() def authorization(phone, password): url = 'https://m.vk.com' response = auth_session.get(url) login_form_action = get_form_action(response.text) if not login_form_action: raise Exception('VK changed login flow') login_form_data = { 'email': phone, 'pass': password } response = auth_session.post(login_form_action, login_form_data) def get_short(link): url = 'https://vk.com/cc?act=shorten&al=1&link='+link headers = {"Content-Type": "application/x-www-form-urlencoded", "X-Requested-With": "XMLHttpRequest"} response = auth_session.post(url=url, headers=headers) return response.text Who can did server implementation of reduction of links through VK? I would be grateful for the help!
linktoo - andreymal