Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save yonkidoodle/98ee6f2cdc53a248e4c1bdf81b73f3a3 to your computer and use it in GitHub Desktop.
Save yonkidoodle/98ee6f2cdc53a248e4c1bdf81b73f3a3 to your computer and use it in GitHub Desktop.
Video Stream Downloader
Display the source blob
Display the rendered blob
Raw
{
"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
}
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment