Skip to content

Instantly share code, notes, and snippets.

@spectrvrc
Created December 10, 2017 09:19
Show Gist options
  • Save spectrvrc/6aada205c30a70796b80d0c7275ac151 to your computer and use it in GitHub Desktop.
Save spectrvrc/6aada205c30a70796b80d0c7275ac151 to your computer and use it in GitHub Desktop.
Download JW Player Videos
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