#2163·pytube

Tiktok

Author: mohamedjemale75-creatorCreated Sep 7, 2025Updated Sep 7, 2025

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")