script python to download videio from any website

Solutions on MaxInterview for script python to download videio from any website by the best coders in the world

showing results for - "script python to download videio from any website"
Leia
15 Oct 2016
1import requests
2
3def download_file(url):
4    local_filename = url.split('/')[-1]
5    # NOTE the stream=True parameter
6    r = requests.get(url, stream=True)
7    with open(local_filename, 'wb') as f:
8        for chunk in r.iter_content(chunk_size=1024): 
9            if chunk: # filter out keep-alive new chunks
10                f.write(chunk)
11                #f.flush() commented by recommendation from J.F.Sebastian
12    return local_filename
13
14download_file("http://www.jpopsuki.tv/images/media/eec457785fba1b9bb35481f438cf35a7_1351466328.mp4")
15