Skip to content

Tiktok #2163

@mohamedjemale75-creator

Description

@mohamedjemale75-creator

from pytube import YouTube
from youtubesearchpython import VideosSearch

def download_video(query, path="."):
try:
# Search for videos
videos_search = VideosSearch(query, limit=1)
result = videos_search.result()["result"][0]

    video_url = result["link"]
    video_title = result["title"]
    
    print(f"Found video: {video_title}")
    print(f"Downloading from: {video_url}")
    
    # Download with pytube
    yt = YouTube(video_url)
    stream = yt.streams.get_highest_resolution()
    stream.download(output_path=path)
    
    print(f"✅ Download complete: {video_title}")
except Exception as e:
    print(f"❌ Error: {e}")

if name == "main":
team_or_player = input("Enter football team or player name: ")
download_video(team_or_player + " football highlights", path="downloads")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions