-
-
Save klausenbusk/da1055dde00ce81ba3c4 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
#!/bin/python | |
import os | |
import sys | |
import requests | |
from datetime import datetime | |
from re import sub | |
url = sys.argv[1] | |
slug = url.split("/")[-1] | |
r = requests.get("http://www.dr.dk/mu-online/api/1.0/programcard/%s" % slug) | |
programcard = r.json() | |
Title = programcard['Title'] | |
PrimaryBroadcast = r.json()['PrimaryBroadcast']; | |
BroadcastDate = PrimaryBroadcast['BroadcastDate'] | |
date = datetime.strptime(BroadcastDate, '%Y-%m-%dT%H:%M:%SZ').strftime('%Y-%m-%d') | |
filename = sub('( |: |:)', "-", Title) + "-" + date + ".mp4" | |
os.system("livestreamer {0} best -o \"{1}\"".format(url, filename)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment