YouTube's "recommended videos" are based on viewing history (i.e. personalization), either from cookies or account history.
When scraping recommended videos using beautifulsoup, is there any personalization?
Note: the beautifulsoup "recommended videos" do not match my own when I manually search, suggesting that my own personalization does not affect the results. But does some other personalization affect the results?
import urllib.request
from bs4 import BeautifulSoup
goto = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
body = urllib.request.urlopen(goto)
soup = BeautifulSoup(body, from_encoding=body.info().get_param('charset'))
recommended_urls =[]
for link in soup.find_all('a', href=True):
if "/watch?" in link['href']:
recommended_urls.append(link['href'])
list(set(recommended_urls))