Last active
November 5, 2017 16:09
Revisions
-
Aurelius Wendelken revised this gist
Nov 5, 2017 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- import requests -
Aurelius Wendelken created this gist
Nov 5, 2017 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ #!/usr/bin/env python import requests def download_stream(video_url, video_name): with open(video_name, 'wb') as handle: response = requests.get(video_url, stream=True) download_size = 0 total_length = response.headers.get('content-length') if total_length is None: # no content length header handle.write(response.content) else: for data in response.iter_content(chunk_size=4096): download_size += len(data) handle.write(data) def main(): with open('arte_list.txt', 'r') as f: a = f.readlines() x = [] y = [] for n, i in enumerate(a): if not i.startswith('\n') and i.startswith('http'): x.append(i.strip('\n')) if not i.startswith('\n') and not i.startswith('http'): y.append(i.strip('\n')) for b in zip(x, y): print b[0], b[1] download_stream(b[0], b[1]) if __name__ == '__main__': main()