import requests
from bs4 import BeautifulSoup
from fake_useragent import UserAgent
import time
session = requests.Session()
headers = {'User-Agent': UserAgent().chrome}
r = session.get("https://ssstik.io/ru", headers=headers)
soup = BeautifulSoup(r.content.decode(), 'html.parser')
for e in soup.find_all("form"):
str_post = e.get('data-hx-post')
str_e = e.get('include-vals')
res = {sub.split(":")[0]: sub.split(":")[1].replace("'", "") for sub in str_e.split(", ")}
data = {'id': "https://www.tiktok.com/@sonyakisa8/video/6831059289537318149", 'local': 'ru'}
data.update(res)
headers['hx-active-element'] = 'submit'
headers['hx-current-url'] = 'https://ssstik.io/ru'
headers['hx-request'] = 'true'
headers['hx-target'] = 'target'
r = session.post(f"https://ssstik.io{str_post}", headers=headers, data=data)
print("sst", r, r.content)
headers = {
'authority': 'www.tiktok.com',
'cache-control': 'max-age=0',
'upgrade-insecure-requests': '1',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36',
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'sec-fetch-site': 'none',
'sec-fetch-mode': 'navigate',
'sec-fetch-user': '?1',
'sec-fetch-dest': 'document',
'accept-language': 'ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7',
'cookie': 'tt_webid=6908780552025048581; tt_webid_v2=6908780552025048581; tt_csrf_token=OdyRs1coLB0lMNb8N_OZTujV; bm_sz=6D793FF3D914E1F811E3E30E1854C327~YAAQzmgjF/RyB1l3AQAASPYHkArNnpwGKSkh/vZp7mgmCjS6m7XEfGWUtU8Qbz4yP+nwNMb9EvjsgMlG/fMbdLnEX+g2vgSbU9RydQHx1ybwlvsNfYGOF9zx8KzQfTekWXvaY+4GQXbqu4bdSL+e6Rp1emQ9eNmiOAzzD0pge0rVcULumiAS68A5vdfn3vfy; csrf_session_id=ea4f00bd7a7c499cb78a8a251e907584; MONITOR_WEB_ID=6908780552025048581; _abck=1822AB6CBDD4E149B7E7A23BBA1F0E62~0~YAAQzmgjFwBzB1l3AQAAPvkHkAUjhkGsUk/9O+GwX+KijraWT53uvwWQ7rSjJ5N7cSCq82DWROBf/xDcQOX4PW+5WXCExAJJdzbW6bzf4ryerLp7OGzQpMnKGOjmDySVEYEAUhrUs5v1RYrPiC+yMd2bQES6t2DLvcjR3c7mJW5mcyfjEVO/shjW21LLzbArTD5qAEV8gosAVNXLgx/gbfPs96St0Wvan99O7jWNLW2T1gSVEcBl3umsNZaiE8CtG2vyrzlFRb9eA5ITpqME3gcMoekEyW2KByhXdNGzsjQJaDuHRNpgwSxgCoRZwP3Dzc4b3ooDvHYd+OggSLe+PVwg7U840g==~-1~||1-eiCfsDdNWn-1-10-1000-2||~-1; ak_bmsc=5197FF6C00FF90119841458103349C86172368CEB53F000038DF2460DA9A536D~plsrRpDwUQwmZurF5TgD3ZWCvCJbzWaLqQlWjJViXXk57ZTlAzt2Cd/JvFbf7JRRgoF4I9YZbqOclxNfRPhZ+NcG9gbW8uZSYvJvR+K5tCC7Bep3vaM86rz0QVMBw4GUf3snjfk39sVSs13quCKh87sWu2HHZqPExdea6oP7k1Zgm4+lNNsQvx33DuG5E5Ht44GrgjNwBU70WITJX9I/HUl+361o2MK/rtoAYPfdA/r75U0H0kdrMwxqka/vp9kTph; R6kq3TV7=AIb5B5B3AQAAcotFQoLLTvG4UOJAqLzGV6n76G98hd5xeH3uO8BalshTkJCe|1|0|12fee6d79f0b1e7e31f042523389dc708bf7ac81; s_v_web_id=verify_kl0jxaa3_mcua199m_1WiC_4jZs_9jRZ_tGWJPpIyc68u; bm_sv=A2BAD33DA04EDBE61888300E9F54D585~27SwqkQBcMsgGCzDzWJRCuBKWhYajGn+7mOgqxZ0dpXBmf21aS6XHvVAcLhfo3DFnK4Ea31j+VIYk6hkQyECDLdfveveDz7Iurv3tvG4PY4+Ky8c9wEGdfkuxSX62wr1QnsOVRmPIyuwvhYbCWDigljIFFAQN+GAHDE7WXU5LQU='
}
r = session.get("https://www.tiktok.com/@sonyakisa8/video/6831059289537318149", headers=headers)
File "/home/raza/.pyenv/versions/anaconda3-4.2.0/envs/mizuho/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 438, in get_code
return self._pyz_archive.extract(fullname)[1]
File "/home/raza/.pyenv/versions/anaconda3-4.2.0/envs/mizuho/lib/python3.7/site-packages/PyInstaller/loader/pyimod02_archive.py", line 371, in extract
obj = zlib.decompress(obj)
zlib.error: Error -3 while decompressing data: incorrect header check
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "site-packages/PyInstaller/loader/pyiboot01_bootstrap.py", line 25, in <module>
File "/home/raza/.pyenv/versions/anaconda3-4.2.0/envs/mizuho/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 607, in exec_module
bytecode = self.get_code(spec.loader_state)
File "/home/raza/.pyenv/versions/anaconda3-4.2.0/envs/mizuho/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 440, in get_code
raise ImportError('Loader FrozenImporter cannot handle module ' + fullname)
ImportError: Loader FrozenImporter cannot handle module os
[187467] Failed to execute script pyiboot01_bootstrap```
longpoll = VkLongPoll(vk_session)
while True:
for event in longpoll.listen():
if event == 1:
while True:
#идет перебор значений