You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
|
11 months ago
|
import requests
|
||
|
|
from bs4 import BeautifulSoup
|
||
|
|
import cloudscraper
|
||
|
|
from zenrows import ZenRowsClient
|
||
|
|
|
||
|
|
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"}
|
||
|
|
|
||
|
|
def get_tiktok_video(url):
|
||
|
|
client = ZenRowsClient("39cf41d4c1ffcb944fca23a95fee8a2722bf4f28")
|
||
|
|
data = client.get(url, headers=headers)
|
||
|
|
soup = BeautifulSoup(data.text, 'html.parser')
|
||
|
|
|
||
|
|
video_url = soup.find('div', class_='video_html5').find('video').get('src')
|
||
|
|
|
||
|
|
return video_url
|
||
|
|
|
||
|
|
def get_user_videos(username):
|
||
|
|
url = f'https://urlebird.com/user/{username}/'
|
||
|
|
|
||
|
|
client = ZenRowsClient("39cf41d4c1ffcb944fca23a95fee8a2722bf4f28")
|
||
|
|
data = client.get(url)
|
||
|
|
soup = BeautifulSoup(data.text, 'html.parser')
|
||
|
|
|
||
|
|
video_urls = []
|
||
|
|
foundVideos = soup.find_all('div', class_='thumb')
|
||
|
|
for video in foundVideos:
|
||
|
|
videoURL = video.find_all('a')[-1].get('href')
|
||
|
|
video_urls.append(videoURL)
|
||
|
|
|
||
|
|
return video_urls
|
||
|
|
|
||
|
|
get_tiktok_video('https://urlebird.com/video/7295074788165373190/')
|
||
|
|
|
||
|
|
videos = get_user_videos('liliashaked')
|
||
|
|
|
||
|
|
for video in videos:
|
||
|
|
print(get_tiktok_video(video))
|