def tudou_download(url, vidfmt): http = HttpUtil() html = http.get(url) charset = http.parse_charset() html = html.decode(charset) iid = r1(r'"k":([^,]*),', html) if not iid: iid = r1(r'iid\s*[:=]\s*(\d+)', html) assert iid title = r1(r"kw\s*[:=]\s*['\"]([^']+)['\"]", html) assert title title = unescape_html(title) return tudou_download_by_iid(iid, title)
def info(self, url, vidfmt): headers = { 'Referer': 'http://www.iqiyi.com/player/20140626170254/Player.swf', 'User-Agent': r'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:30.0) Gecko/20100101 Firefox/30.0', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' } html = self.http.get(url, headers=headers) videoId = r1(r'''data-player-videoid\s*[:=]\s*["']([^"']*)["']''', html) info_url = r'http://cache.video.qiyi.com/vms?key=fvip&src=p&vid={}'.format( videoId) html = self.http.get(info_url, headers=headers) js = json.loads(html) vstream = js['data']['vp'] # du = 'http://data.video.qiyi.com' # nvid = e2847b3b9b81469cbf7247ee8a1da61f du, dts, nvid = vstream['du'], vstream['dts'], vstream['nvid'] for vs in vstream['tkl'][0]['vs']: for fs in vs['fs']: b, d, l, msz = fs['b'], fs['d'], fs['l'], fs['msz'] real_url = 'http://data.video.qiyi.com/{}/videos{}'.format( nvid, l) addr = html = self.http.get(real_url, headers=headers) print addr
def __info(self, url, vidfmt): parse_url = 'http://www.yytingting.com/bookstore/playAndDownload.action?' \ 'id=%s&pageNo=%d&pageSize=%d' id = _util.r1('bookId=(\d+)', url) http = HttpUtil() http.add_header('Referer', url) tmp = parse_url % (id, 1, 20) info = http.get(tmp) js = json.loads(info) data = js['data']['data'] pageNo = js['data']['pageNo'] pageSize = js['data']['pageSize'] total = js['data']['total'] urls1 = [] for i in range(total/pageSize): url = parse_url % (id, i+1, pageSize) html = http.get(url) js = json.loads(html) fmt = 'http://www.yytingting.com/resource/getPlayUrl.action?id=%d&type=6' urls1 = urls1 + [(data['resName'], fmt % data['resId']) for data in js['data']['data']] urls = [] for name, url in urls1: html = http.get(url) js = json.loads(html) urls.append((name, js['data']['url'])) return urls
def info(self, url, vidfmt): headers = { 'Referer': 'http://www.iqiyi.com/player/20140626170254/Player.swf', 'User-Agent': r'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:30.0) Gecko/20100101 Firefox/30.0', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' } html = self.http.get(url, headers=headers) videoId = r1(r'''data-player-videoid\s*[:=]\s*["']([^"']*)["']''', html) info_url = r'http://cache.video.qiyi.com/vms?key=fvip&src=p&vid={}'.format(videoId) html = self.http.get(info_url, headers=headers) js = json.loads(html) vstream = js['data']['vp'] # du = 'http://data.video.qiyi.com' # nvid = e2847b3b9b81469cbf7247ee8a1da61f du, dts, nvid = vstream['du'], vstream['dts'], vstream['nvid'] for vs in vstream['tkl'][0]['vs']: for fs in vs['fs']: b, d, l, msz = fs['b'], fs['d'], fs['l'], fs['msz'] real_url = 'http://data.video.qiyi.com/{}/videos{}'.format(nvid, l) addr = html = self.http.get(real_url, headers=headers) print addr
def Euler321_2DCM(psi, theta, phi): from util import r1, r2, r3 return r1(phi).dot(r2(theta).dot(r3(psi)))
def Euler321_2DCM(psi,theta,phi): from util import r1, r2, r3 return r1(phi).dot(r2(theta).dot(r3(psi)))