#!/usr/bin/env python
__all__ = ['pptv_download', 'pptv_download_by_id']
from ..common import *
import re
import urllib
import hashlib
def pptv_download_by_id(id, title = None, output_dir = '.', merge = True, info_only = False):
xml = get_html('http://web-play.pptv.com/webplay3-151-%s.xml' % id)
host = r1(r'([^<>]+)', xml)
port = 8080
st = r1(r'([^<>]+)', xml).encode('utf-8')
key = hashlib.md5(st).hexdigest() # FIXME: incorrect key
rids = re.findall(r'rid="([^"]+)"', xml)
rid = r1(r'rid="([^"]+)"', xml)
title = r1(r'nm="([^"]+)"', xml)
pieces = re.findall('