Forked from nikhilkumarsingh/Video Stream Downloader (Example-1).ipynb
Created
August 23, 2024 17:30
-
-
Save yonkidoodle/98ee6f2cdc53a248e4c1bdf81b73f3a3 to your computer and use it in GitHub Desktop.
Video Stream Downloader
This file contains hidden or 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 characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import requests" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"url = \"https://files3.lynda.com/secure/courses/786416/VBR_MP4h264_main_SD/786416_00_01_WL30_Batteries.mp4?_JlGPFuqEmh2WYnzy8KqP63YccR5B9TyiaLDUyJqMD8vI0FKsEoIijfxnOyVetNrjDj4fDCUidEarb6NlvSpp8gqOtp4MNS2E_14bhH483Nj8ekt9I0KwkiE6T4k39UnzitRKsZgt55bwl0MhP3aWp1j2U6IsuiqTBssp-Gug0_ZtYFcWvzsH5BN5EsA_A&c3.ri=3775645051486129780\"" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"chunk_size = 256\n", | |
"r = requests.get(url, stream=True)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"with open(\"lynda.mp4\", \"wb\") as f:\n", | |
" for chunk in r.iter_content(chunk_size=chunk_size):\n", | |
" f.write(chunk)" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.6.7" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment