Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

get_videos.py 692 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  1. # script used for downloading the source videos from YouTube
  2. # details about which videos to download are in the config.py file
  3. from pytube import YouTube
  4. import os
  5. from config import VIDEOS_DIR, YT_LINKS_DIR, CLASSES
  6. if __name__ == "__main__":
  7. os.makedirs(os.path.dirname(VIDEOS_DIR), exist_ok=True)
  8. for class_name in CLASSES:
  9. print(f"Downloading the {class_name} video...")
  10. yt = YouTube(YT_LINKS_DIR[class_name])
  11. (
  12. yt
  13. .streams.filter(progressive=True, file_extension="mp4")
  14. .order_by("resolution")
  15. .desc()
  16. .first()
  17. .download(VIDEOS_DIR)
  18. )
  19. print("done.")
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...