Created
March 17, 2018 17:12
-
-
Save p3t3r67x0/f24cab4d8d2993c1553537c680a589d2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import sys | |
import requests | |
from requests.exceptions import MissingSchema | |
def download_m3u8(stream_url, video_name): | |
with open(video_name, 'w') as f: | |
try: | |
response = requests.get('http://{}'.format(stream_url)) | |
f.write(response.text) | |
except MissingSchema as e: | |
print e | |
sys.exit(1) | |
def main(): | |
with open('wdr_list.txt', 'r') as f: | |
video_list = f.readlines() | |
x = [] | |
y = [] | |
for i in video_list: | |
if i.startswith('wdradaptiv') and not i.startswith('\n'): | |
y.append(i.strip()) | |
elif not i.startswith('\n'): | |
x.append(i.strip()) | |
for i in zip(x, y): | |
download_m3u8(i[1], i[0]) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment