Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
automatically downloads nptel videos from youtube
from __future__ import unicode_literals
import sys
import urllib.request
import youtube_dl
class MyLogger(object):
def debug(self, msg):
def warning(self, msg):
def error(self, msg):
def my_hook(d):
if d['status'] == 'finished':
print('Done downloading, now converting ...')
ydl_opts = {
'format': '18',
'logger': MyLogger(),
'progress_hooks': [my_hook],
Urls =
urls = list(filter(None, Urls.split("\n")))
for url in urls:
response = urllib.request.urlopen(url)
webContent ="iso-8859-1")
s_i = webContent.find("v/", webContent.find(""))
e_i = webContent.find("?", s_i)
youtube_url = "" + webContent[s_i+2:e_i]
with youtube_dl.YoutubeDL(ydl_opts) as ydl:[youtube_url])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.