conn = sqlite3.connect('youtube_videos.db')
CREATE TABLE IF NOT EXISTS videos (
cursor.execute("SELECT * FROM videos")
for row in cursor.fetchall():
def add_video(name, time):
cursor.execute('INSERT INTO videos (name, time) VALUES (?, ?)', (name, time))
def update_video(video_id, new_name, new_time):
cursor.execute('UPDATE videos SET name = ?, time = ? WHERE id = ?', (new_name, new_time, video_id))
def delete_video(video_id):
cursor.execute('DELETE FROM videos WHERE id = ?', (video_id))
print("\n Youtube Manager | choose an option")
print("1. List all youtube videos")
print("2. Add a youtube video")
print("3. Update a youtube video detail")
print("4. Delete a youtube video")
choice = input("Enter your choice: ")
name = input("Enter the video name:\n ")
time = input("Enter the video time:\n ")
video_id = input("Enter the video ID to update:\n ")
name = input("Enter the video name:\n ")
time = input("Enter the video time:\n ")
update_video(video_id, name, time)
video_id = input("Enter the video ID to update:\n ")
if __name__ == "__main__":