Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)

        def download(_url):
	lec_no = _url.split('=')[-1]
	file_name = ("%s_%s.mp4") %("Lecture", lec_no) 

	u = urllib2.urlopen(_url)
	f = open(file_name, 'wb')

	meta = u.info()
	file_size = int(meta.getheaders("Content-Length")[0])

	print "Downloading: %s Bytes: %s" % (file_name, file_size)

	file_size_dl = 0
	block_sz = 8192

	while True:
		buf = u.read(block_sz)
		if not buf:
			break

		file_size_dl += len(buf)
		f.write(buf)
		status = r"%10d  [%3.2f%%]" % (file_size_dl, \
            file_size_dl * 100. / file_size)
		status = status + chr(8)*(len(status)+1)
		print status,
	
	f.close()
        


src/c/o/CourseEra-Lectures-Downloader-HEAD/videos.py   CourseEra-Lectures-Downloader(Download)
import sqlite3 as lite
import os
import sys
from module1 import download, scrape
 
 
		for row in rows:
			download(row[0])
			cur.execute("DELETE FROM links WHERE url=?", (row[0],))
			con.commit()