Created
December 10, 2017 09:19
-
-
Save spectrvrc/6aada205c30a70796b80d0c7275ac151 to your computer and use it in GitHub Desktop.
Download JW Player Videos
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
import requests | |
import re | |
def download_file(url): | |
local_filename = url.split('/')[-1] | |
r = requests.get(url, stream=True) | |
with open(local_filename, 'wb') as f: | |
for chunk in r.iter_content(chunk_size=1024): | |
if chunk: | |
f.write(chunk) | |
return local_filename | |
def find_jw_source(url): | |
regex = r"file: \".*.mp4\"" | |
r = requests.get(url) | |
results = [] | |
for line in r.text.splitlines(): | |
if re.findall(regex, line): | |
line = 'http:' + line[9:-2] | |
results.append(str(line)) | |
return results | |
movies = find_jw_source('https://support.jwplayer.com/customer/portal/articles/1431665#fndtn-dashboard') | |
for movie in movies: | |
download_file(movie) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment