清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
import urllib2 from settings import COOKIES opener = urllib2.build_opener() cookies = ";".join("%s=%s" % (k, v) for k, v in COOKIES.items()) opener.addheaders.append(('Cookie', cookies)) req = opener.open(link) meta = req.info() file_size = int(meta.getheaders("Content-Length")[0]) content_type = meta.getheaders('Content-Type')[0].split(';')[0] print file_size, content_type open(file_name, 'wb').write(req.read())