For some reason youtube only gives me their resource pages instead of giving me their video links which is what I am looking for.
code:
import mechanize
import urllib
import urllib.parse as urlparse
url = "https://www.youtube.com"
browser = mechanize.Browser()
browser.open(url)
for link in browser.links():
new_url = urlparse.urljoin(link.base_url,link.url)
b1 = urlparse.urlparse(new_url).hostname
b2 = urlparse.urlparse(new_url).path
print('http://'+b1+b2)
output I got:
http://accounts.google.com/ServiceLogin
<http://www.youtube.com/
http://www.youtube.com/
output I expected:
https://www.youtube.com/watch?v=uVvZlH5gPA
https://www.youtube.com/watch?v=uVvasdad5
