Last active
August 23, 2022 02:34
-
-
Save jjshoots/ab130d3dca0a0d3bdc49fb50d9894b28 to your computer and use it in GitHub Desktop.
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 characters
""" | |
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, | |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | |
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
""" | |
# TODO: | |
# ArindamBanerjee video has duplicate | |
# KateSaenko third video (?) | |
import os | |
from vimeo_downloader import Vimeo | |
def download_video(vimeo_url, embed_url, dirname, filename): | |
"""Does what it says on the tin. | |
Inputs: | |
- vimeo_url: string of the target video | |
- embed_url: string of where the vimeo url came from | |
- dirname: name of the directory that the video should go in | |
- filename: name of the file to be saved as, please include ".mp4" at the end | |
""" | |
v = Vimeo(vimeo_url, embed_url) | |
# list of streams | |
stream = v.streams | |
# download highest quality one | |
stream[-1].download(download_directory=dirname, filename=filename) | |
def process_list(video_list): | |
"""Processes a video list. | |
Inputs: | |
- video_list: { | |
"name": | |
[ | |
embed_url, | |
[video_list, ...] | |
], | |
"name": | |
[ | |
embed_url, | |
[video_list, ...] | |
], | |
... | |
} | |
""" | |
# for each presenter in the dict | |
for name in video_list: | |
# get the embed_url | |
embed_url = video_list[name][0] | |
# download all videos from the vimeo url | |
for i, vimeo_url in enumerate(video_list[name][1]): | |
# formulate filename | |
filename = f"{name}_{i}.mp4" | |
dirname = f"./videos/{name}" | |
# do the shit | |
download_video(vimeo_url, embed_url, dirname, filename) | |
if __name__ == "__main__": | |
# brute forcing all videos is easier than scraping lol | |
video_list = {} | |
video_list["PierreBaldi"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/pierre-baldi/", | |
[ | |
"https://player.vimeo.com/video/734517254?h=b04d08b626&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["ArindamBanerjee"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/arindam-banerjee/", | |
[ | |
"https://player.vimeo.com/video/734296378?h=b7c2285d7c&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734296378?h=b7c2285d7c&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734517568?h=2cc8f55346&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["MikhailBelkin"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/mikhail-belkin/", | |
[ | |
"https://player.vimeo.com/video/734317407?h=aa747dfac6&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734318332?h=ac31392916&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734516242?h=a5a6a11f64&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["WahidBhimji"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/wahid-bhimji/", | |
[ | |
"https://player.vimeo.com/video/733936732?h=b899d3869f&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["Arthur Gretton"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/arthur-gretton/", | |
[ | |
"https://player.vimeo.com/video/734516798?h=3eec5278eb&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734513780?h=762e67841e&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734833543?h=62049c967b&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["JaochimBuhmann"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/joachim-m-buhmann/", | |
[ | |
"https://player.vimeo.com/video/734296779?h=ae8e0c7841&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["MohitIyyer"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/mohit-iyyer/", | |
[ | |
"https://player.vimeo.com/video/734519083?h=ddaffcfbad&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734515617?h=cac5e7b47a&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734833395?h=994e9713d8&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["PhillipIsola"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/phillip-isola/", | |
[ | |
"https://player.vimeo.com/video/733936909?h=5243e75c1f&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734297419?h=429c0cd34b&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734297989?h=183026d8ae&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["IrwinKing"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/irwin-king/", | |
[ | |
"https://player.vimeo.com/video/734517825?h=c9795ee000&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734518170?h=96a59747e4&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734853930?h=0f21f57008&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["TorLattimore"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/tor-lattimore/", | |
[ | |
"https://player.vimeo.com/video/734514362?h=e8f273efda&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734833884?h=f718dc2820&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734831853?h=4829832ee3&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["VincentLepetit"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/vincent-lepetit/", | |
[ | |
"https://player.vimeo.com/video/734070695?h=6c6748c562&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734299016?h=82f2950618&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734298585?h=feed6165c8&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["DimitrixMetaxas"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/dimitris-n-metaxas/", | |
[ | |
"https://player.vimeo.com/video/734432400?h=a83d150c89&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734319356?h=826bc01f1e&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734320034?h=ce8c801c1c&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["SeanMeyn"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/sean-meyn/", | |
[ | |
"https://player.vimeo.com/video/734327920?h=d67b620a32&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/733552183?h=230a66d1a5&title=0&byline=0&portrait=0&speed=0&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/733937085?h=afe8eb7bc6&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["LouisMorency"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/louis-philippe-morency/", | |
[ | |
"https://player.vimeo.com/video/734518586?h=cca1388839&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["KateSaenko"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/kate-saenko/", | |
[ | |
"https://player.vimeo.com/video/734518939?h=7435d7ebdc&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734519053?h=1aa924ce91&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["WojciechSamek"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/wojciech-samek/", | |
[ | |
"https://player.vimeo.com/video/733352042?h=31846c3d69&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/733552762?h=9c074389b9&title=0&byline=0&portrait=0&speed=0&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/733937299?h=0399f294a9&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["ClarisaSanchez"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/clarisa-sanchez/", | |
[ | |
"https://player.vimeo.com/video/733665333?h=8fcc194e76&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/733675253?h=bf1fb492d0&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734432651?h=5e47ec968a&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["BjornSchuller"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/bjorn-w-schuller/", | |
[ | |
"https://player.vimeo.com/video/733241997?h=76997c2724&title=0&byline=0&portrait=0&speed=0&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/733354706?h=c7598e04d6&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734071284?h=2e3b43d0cf&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["JonathanSchlens"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/jonathon-shlens/", | |
[ | |
"https://player.vimeo.com/video/733242627?h=dcd2cebaf4&title=0&byline=0&portrait=0&speed=0&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/733563475?h=375ae0680a&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734071868?h=21c82124b3&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["JohanSuykens"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/johan-suykens/", | |
[ | |
"https://player.vimeo.com/video/733553125?h=69abed7aa9&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/733937463?h=9a4fd51cc7&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/733937661?h=a730b62ff9&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["AMuratTekalp"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/a-murat-tekalp/", | |
[ | |
"https://player.vimeo.com/video/734515139?h=8dfee9ef12&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734832315?h=d3b9f24ea6&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734832687?h=96e5d70a02&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["AlexandreTkatchenko"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/alexandre-tkatchenko/", | |
[ | |
"https://player.vimeo.com/video/733708941?h=1513af808f&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734428584?h=21f333a11b&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734431408?h=4478ff8e49&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["LiXiong"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/li-xiong/", | |
[ | |
"https://player.vimeo.com/video/733690286?h=3fee9699dd&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/733702635?h=daf0f66354&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734441049?h=ec1e1eda7a&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
video_list["MingYuan"] = [ | |
"https://deeplearn2022summer.com/portfolio-item/ming-yuan/", | |
[ | |
"https://player.vimeo.com/video/734515942?h=ec92e00df4&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734833128?h=8c8c7f69a4&badge=0&autopause=0&player_id=0&app_id=58479", | |
"https://player.vimeo.com/video/734832989?h=e2a0c6c8b6&badge=0&autopause=0&player_id=0&app_id=58479", | |
] | |
] | |
process_list(video_list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanx a lot, friend!
I was thinking I'll use "good" (read "bad") ol'
bash
and Swiss army knife for downloading videos -youtube-dl
(on Linux, it has certainly its Mac/Win versions). You saved me A LOT OF TIME;-)