X-Git-Url: https://git.ao2.it/smooth-dl.git/blobdiff_plain/5a4d002ae168b131ab3fa90c3b773cdff99af7e9..46bd7ee8ae71246b460440c59a4e34b8e86b8398:/smooth-dl.py diff --git a/smooth-dl.py b/smooth-dl.py index 36ba345..a496bc7 100755 --- a/smooth-dl.py +++ b/smooth-dl.py @@ -30,18 +30,19 @@ # basically, write a proper implementation of manifest parsing and chunk # downloading - -__description = "Download videos served using Smooth Streaming technology" -__version = "0.x" -__author_info = "Written by Antonio Ospite http://ao2.it" - import os +import re import sys import xml.etree.ElementTree as etree import urllib2 import struct import tempfile from optparse import OptionParser +from urlparse import urlparse, urlunparse + +__description__ = "Download videos served using Smooth Streaming technology" +__version__ = "0.x" +__author_info__ = "Written by Antonio Ospite http://ao2.it" def get_chunk_data(data): @@ -52,10 +53,10 @@ def get_chunk_data(data): data_start = moof_size + 4 + len('mdat') data_size = mdat_size - 4 - len('mdat') - #print len(data[data_start:]), \ + # print len(data[data_start:]), \ # len(data[data_start:data_start + data_size]), data_size - assert(len(data[data_start:]) == data_size) + assert len(data[data_start:]) == data_size return data[data_start:data_start + data_size] @@ -63,7 +64,7 @@ def get_chunk_data(data): def hexstring_to_bytes(hex_string): res = "" for i in range(0, len(hex_string), 2): - res += chr(int(hex_string[i:i + 2], 16)) + res += chr(int(hex_string[i:i + 2], 16)) return res @@ -92,53 +93,68 @@ def write_wav_header(out_file, fmt, codec_private_data, data_len): out_file.write(struct.pack('