i've tried out python module called "Youtube-search" and here's the little code to get a link of the first video
from youtube_search import YoutubeSearch
results = YoutubeSearch('Sabaton', max_results=10).to_dict()
dictionary = results[0]
print(f"youtube.com{dictionary.get('link')}")
the search term ("Sabaton") was always the same sometimes it gave me the link like it should have but sometimes it throws this error at me
dictionary = results[0]
IndexError: list index out of range
i dont know why it's giving me this error sometimes, considering as mentioned above the search terms didnt change and they were all made in a short period of time so there was no chance that a new video was uploaded with tag "Sabaton"