Web automation correction

I am new to cooding. I am doing a project. The steps are mentioned below:-
Step 1 :- Open YouTube then search for a video and find it then click on it and after clicking on the video open pinned comment then click on the link.

I got the solution for step 1 :-
You could bypass the need of starting off at the homepage completely by appending the desired search query to the search_query parameter 🙂

from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC driver = webdriver.Chrome() driver.maximize_window() wait = WebDriverWait(driver, 3) presence = EC.presence_of_element_located visible = EC.visibility_of_element_located # Navigate to url with video being appended to search_query driver.get(‘https://www.youtube.com/results?search_query={}’.format(str(video))) # play the video wait.until(visible((By.ID, “video-title”))) driver.find_element(By.ID, “video-title”).click()

Now the upper answer is matching with my automation project but please help me add the last lines to :-
Their is a link in pinned comment and i need the code to click it after the upper code finishes it’s work.
I tried my best to explain my problem, incase my explanation is not good then please suggest me with corrections. Thankyou.