input: Write a python function to scrape YouTube video links using BeautifulSoup and requests libraries.
  assert len(scrape_youtube_links('educational videos')) > 0
  assert 'watch' in scrape_youtube_links('python programming')[0]
  assert scrape_youtube_links('nonexistentquery') == []
output: def scrape_youtube_links(query):
      import requests
      from bs4 import BeautifulSoup
      import urllib.parse
  
      search_url = "https://www.youtube.com/results"
      params = {"search_query": query}
      url = f"{search_url}?{urllib.parse.urlencode(params)}"
  
      response = requests.get(url)
      soup = BeautifulSoup(response.text, 'html.parser')
  
      links = []
      for video in soup.find_all('a', href=True):
          href = video['href']
          if '/watch' in href:
              links.append(f"https://www.youtube.com{href}")
  
      return links