I was wondering if there is a way to measure the page load time of youtube.com
or any video hosted on youtube.com
via pycurl
.
For example, if I were to measure page load time for google.com
then I would just perform a query for that url. But for youtube, the first http request doesn't bring back the entire video. Is there a way to do it in pycurl or perhaps via some other method?
I Would be grateful for any pointers regarding this.
Use Pytube
Install it with pip install pytube
Here is a the code snippet you should be using to download a video.
from pytube import YouTube
yt = YouTube("http://www.youtube.com/watch?v=Ik-RsDGPI5Y")
video = yt.get('mp4', '720p')
video.download('/tmp/') # downloaded video to /tmp directory
You can time the video.download
command.