-
-
Save gokart23/7bbaf3f8d09037ec0ff03d19188959a8 to your computer and use it in GitHub Desktop.
Download videos from Panopto based on RSS feed file
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
#!/bin/env python3 | |
import argparse, sys | |
import os, subprocess | |
import xml.etree.ElementTree as ET | |
parser = argparse.ArgumentParser() | |
parser.add_argument("--rssfile", help="Location of RSS feed file downloaded from Panopto", | |
required=True, type=argparse.FileType('r')) | |
args = parser.parse_args() | |
with args.rssfile as rss: | |
et = ET.parse(rss) | |
root = et.getroot() | |
for name, url in zip((e.text for e in root.findall('./channel/item/title')), | |
(e.attrib['url'] for e in root.findall('./channel/item/enclosure'))): | |
download_name = f"{name.replace(' ', '-')}.mp4" | |
if os.path.isfile(download_name): | |
print(f'Skipping {download_name} because it already exists') | |
else: | |
subprocess.run(['wget', f"-O{download_name}", url]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment