-
Notifications
You must be signed in to change notification settings - Fork 0
/
fetch_from_file.py
33 lines (25 loc) · 1.08 KB
/
fetch_from_file.py
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
28
29
30
31
32
33
import argparse
from learn_video_helper import VideoDownloader
def process_links_from_file(file_path, preferred_languages):
with open(file_path, 'r') as file:
links = file.readlines()
for link in links:
link = link.strip()
print(f"Processing link: {link}")
downloader = VideoDownloader(link)
downloader.run(
download_high_quality=True,
download_medium_quality=False,
download_low_quality=False,
download_audio=True,
download_captions=True,
preferred_languages=preferred_languages
)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Download videos from Microsoft Learn.')
parser.add_argument('file_path', type=str, help='Path to the text file containing links')
parser.add_argument('--languages', nargs='+', default=['en-us'], help='Preferred languages for subtitles')
args = parser.parse_args()
file_path = args.file_path
preferred_languages = args.languages
process_links_from_file(file_path, preferred_languages)