PYTHON   194
tmp TikTok
By test on 18th July 2021 10:50:06 AM


  1. import requests
  2. import re
  3. from   bs4 import BeautifulSoup
  4.  
  5. def no_wotemark_video(url_for_no_wotemark_video):
  6.     session = requests.Session()
  7.     url = "https://ssstiktok.io/results"
  8.     tickTokUrl = url_for_no_wotemark_video
  9.     splits = tickTokUrl.split("/");
  10.     videoId = splits[len(splits) - 1]
  11.  
  12.     headers = {
  13.     "Host": "ssstiktok.io",
  14.     "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0",
  15.     "Accept": "text/html-partial, */*; q=0.9",
  16.     "Accept-Language": "ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3",
  17.     "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
  18.     "X-IC-Request": "true",
  19.     "X-HTTP-Method-Override": "POST",
  20.     "X-Requested-With": "XMLHttpRequest",
  21.     "Content-Length": "329",
  22.     "Origin": "https://ssstiktok.io",
  23.     "Connection": "keep-alive",
  24.     "TE": "Trailers",
  25.     "Pragma": "no-cache",
  26.     "Cache-Control": "no-cache",
  27.     "Cookie": "__cfduid=dbf0d8ab302c911cdb6c334bce514d20c1592822426; PHPSESSID=337c2h2tmvcv6p8pe98flfih5f; lang=ru; __gads=ID=00cd17aed5494363:T=1592822428:S=ALNI_MZAGyZ8fryNAxzHzpemOaPg8iMzKw; _ga=GA1.2.1811115897.1592822429; _gid=GA1.2.861703323.1592822429; _gat_UA-3524196-6=1; __atuvc=7%7C26; __atuvs=5ef0a0dc805549e9005",
  28.     }
  29.    
  30.     body = {
  31.     'ic-request': 'true',
  32.     'id': tickTokUrl,
  33.     'ic-element-id': 'main_page_form',
  34.     'ic-id': '1',
  35.     'ic-target-id': 'active_container',
  36.     'ic-trigger-id': 'main_page_form',
  37.     'token': '765a943f8ad513d18f3f22d69d562d09l90e78d6b4468ac23d9a19d819ce2f36f',
  38.     'ic-current-url': '/ru',
  39.     'ic-select-from-response': '#idbaeddf',
  40.     '_method': 'POST'
  41.     }
  42.  
  43.     # запрос видео с сервиса, получаес ответ в виде html
  44. чаес ответ в виде html
  45.     data = session.post(url, headers=headers, data=body).content
  46.     print(data)
  47.     soup = BeautifulSoup(data, 'lxml')
  48.     aHref = soup.findAll('a', class_='btn btn-prima# найденна ли необходимая ссылка
  49. k')
  50. # найденна ли необходимая ссылка
  51.     if aHref is not None:
  52.         href_conntent = aHref[0].get("href")
  53.         print('Чистое видео:',href_conntent)
  54.     els#videoRaw = session.get(href_conntent).content
  55. �а�#return videoRaw
  56. �н элемент или ссылка")
  57.  
  58.     #videoRaw = session.get(href_conntent).content
  59.     #return videoRaw
  60.  
  61. url_for_no_wotemark_video = 'https://www.tiktok.com/@food_surgery.x0/video/6840053615961427205'
  62. url_for_no_wotemark_video = 'https://www.tiktok.com/@reto

Raw Paste

Login or Register to edit or fork this paste. It's free.