“”“
5/26/14 修改,
去除下载部分=。=,直接解析出地址。。然后没有然后了。。
”“”
主要就这句。。。
"http://m.youku.com/wireless_api3/videos/'videoid'/playurl?format=1,2,4,5,6"
代码:
#coding=utf-8 import re; import json; import urllib; import urllib.request; header = { "User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/32.0.1700.107 UBrowser/1.0.370.1388 Safari/537.36",} URL_GETYKVIDEO = "http://m.youku.com/wireless_api3/videos/{0}/playurl?format=1,6"; class YoukuFetcher: def __init__(self): pass; def fetch(self,id): request = urllib.request.Request(URL_GETYKVIDEO.format(id),headers = header); ret = json.loads(urllib.request.urlopen(request).read().decode("utf-8")); try: result = ret["results"]; mp4s = result["mp4"]; for item in mp4s: yield item["url"]; except:#debug print(ret); def main(): fetcher = YoukuFetcher(); list = fetcher.fetch("XNzE1NjgxNDM2"); for item in list: print(item); if(__name__ == "__main__"): main();原文链接:https://www.f2er.com/regex/362377.html