Skip to content

Instantly share code, notes, and snippets.

@p3t3r67x0
Last active November 5, 2017 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save p3t3r67x0/330112f1e60f64831affa639c316ee8f to your computer and use it in GitHub Desktop.
Save p3t3r67x0/330112f1e60f64831affa639c316ee8f to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment