Removed vids so cloning doesn't take forever.
This commit is contained in:
@@ -108,3 +108,4 @@ venv.bak/
|
||||
.idea/
|
||||
.pytest_cache/
|
||||
.coveragerc
|
||||
*.mp4
|
||||
|
||||
@@ -1,6 +1,34 @@
|
||||
# Fractal test is from: https://www.youtube.com/watch?v=WgXQ59rg0GM
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
test_video = os.path.join(os.path.dirname(__file__), "fractal test.mp4")
|
||||
test_video_2 = os.path.join(os.path.dirname(__file__), "fractal test 2.mp4")
|
||||
test_video = str(Path.joinpath(Path(__file__).parent, "fractal test.mp4"))
|
||||
test_video_2 = str(Path.joinpath(Path(__file__).parent, "fractal test 2.mp4"))
|
||||
test_video_3 = str(Path.joinpath(Path(__file__).parent, "fractal test 3.mp4"))
|
||||
|
||||
urls = {
|
||||
"test_video": "https://www.youtube.com/watch?v=LpWhaBVIrZw",
|
||||
"test_video_2": "https://www.youtube.com/watch?v=GASynpGr-c8",
|
||||
"test_video_3": "https://www.youtube.com/watch?v=u_P83LcI8Oc"
|
||||
}
|
||||
|
||||
|
||||
def populate_videos(fps=60, res="720p", ext="mp4"):
|
||||
from pytube import YouTube # Note: pip install pytube3, not pytube
|
||||
from pathlib import Path
|
||||
for n, v in globals().items():
|
||||
if 'test_video' in n:
|
||||
print(f"Checking if '{n}' is downloaded.")
|
||||
if Path(v).exists():
|
||||
print("Video already downloaded.")
|
||||
else:
|
||||
the_path = Path(v)
|
||||
print("Downloading...")
|
||||
YouTube(urls[n]) \
|
||||
.streams \
|
||||
.filter(fps=fps, res=res, file_extension=ext)[0] \
|
||||
.download(output_path=the_path.parent, filename=the_path.stem)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
populate_videos()
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user