I am trying to download an entire play list for Android development tutorial from Youtube. So I used savefrom for generating playlist for download. But the problem is that I have so many videos in that playlist. So, I decided to write a python script for making this work simpler. But the problem is it uses Java Script to generate the link so I cant able to fetch generated link using javascript()
Example: http://ssyoutube.com/watch?v=AfleuRtrJoA It takes 5 sec to generate download links.
I want to get page source only after 5 sec from the browse.
For this kind of work I found a good package named selenium.
import time
from selenium import webdriver
def savefromnotnet(url):
browser = webdriver.Firefox() # Get local session of firefox
browser.get(url) # Load page
time.sleep(5) # Let the page load, will be added to the API
return browser.page_source()
source = savefromnotnet("http://ssyoutube.com/watch?v=AfleuRtrJoA")
The savefromnotnet function open's Firefox and it will request the url, up to this every thing works fine.
But when I want to get page source browser.page_source() it shows the following error.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 523, in runfile
execfile(filename, namespace)
File "C:\Users\BK\Desktop\Working Folder\Python Temp\temp.py", line 10, in <module>
source = savefromnotnet("http://ssyoutube.com/watch?v=AfleuRtrJoA")
File "C:\Users\BK\Desktop\Working Folder\Python Temp\temp.py", line 8, in savefromnotnet
return browser.page_source()
TypeError: 'unicode' object is not callable