11 Mar

A friend posted on twitter that he wanted to download all the TED Talks. He could not find a way to do that. So I thought of writing a python script which downloads all the TED Talk videos.

For the ones who want to know how to do that:

I read about BeautifulSoup, urllib, urllib2.
Wrote an algorithm.
Made the CLI.

The code is:

import urllib
from BeautifulSoup import BeautifulSoup

url = "file:///home/kunj/Downloads/Python-2.7.2/ted.html"

hrefs = soup.findAll( "a" ,{ "target" :True, "href" :True, "style" :True})

for links in hrefs:
    m= str(links.contents)
    link1= m[3:-2]
    vid_link = soup1.find("meta",{"property":"og:video","content":True})["content"]
    print vid_link
    filename = vid_link.split("/")[-1]

This code can be further shortened but then I am a lazy fellow πŸ˜› πŸ˜‰

This is my second GitHub repository.

PS: There are total 1048 Ted Talk videos πŸ˜€ So run the script and be patient.
PPS: Recommended only if you have an unlimited internet plan or your dad has a lot of money. πŸ˜€ πŸ˜‰ No offence.

1 Comment

Posted by on March 11, 2012 in Python


Tags: , , ,

One response to “TedTalksDownloader

  1. akash patil

    May 31, 2012 at 8:34 am

    the question is TED kya hota hai!!!
    u shd hv added wat it is 2 cater 4 non engineering students also!!!!(read me)!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: