YouTube link bulma kodunda harf duyarlılığı nasıl kapatılır?

Cengizhanjj

Femtopat
Katılım
8 Aralık 2022
Mesajlar
52
Daha fazla  
Cinsiyet
Erkek
Yardım edebilirseniz mutlu olurum
Python:
import requests
import json

def get_song_video(song_name):
    api_key = "Güvenlik amaçlı Vermiyorum"
    base_url = "https://www.googleapis.com/youtube/v3/search?part=snippet&q={}&type=video&key={}".format(song_name, api_key)
    response = requests.get(base_url)
    data = json.loads(response.text)
    if data.get("pageInfo") and data["pageInfo"].get("totalResults") and data["pageInfo"]["totalResults"] > 0:
        first_result = data["items"][0]
        video_id = first_result["id"]["videoId"]
        return "https://www.youtube.com/watch?v=" + video_id
    else:
        return None

song_name = input("Şarkı Adı Giriniz: ")
song_video = get_song_video(song_name)
if song_video:
    print("Şarkı Linki: ", song_video)
else:
    print("Şarkı Bulunamadı")

Ama şarkı adınıda linkini de vermeli.
 
Son düzenleme:

Geri
Yukarı