批量下载淘宝 2012年ADC技术嘉年华PDF文件
来源:互联网 发布:金刚级战列舰知乎 编辑:程序博客网 时间:2024/06/04 19:31
感谢淘宝的分享,内容很丰富,下载首页在这里,http://www.taobaotest.com/notices/82
但下载的文件名和标题不对应,一个个改起来麻烦。写了个简单的python脚步,下载后文件名和标题名一致。
再次感谢淘宝的分享,希望baidu, 360,QQ 赶上。
#!/usr/bin/env python#coding=utf-8import threading,urllib2,HTMLParser,time,urllib def download(url,file_name): rfile = urllib.urlopen(url) url=rfile.geturl() urllib.urlretrieve(url,file_name+".pdf") if __name__=="__main__": #lParser = parseDownloadFiles() content=urllib2.urlopen("http://www.taobaotest.com/notices/82").read() start='<h2>Tcon</h2>' end='<div class="article-nav">' content=content[content.find(start):content.find(end)] file_name_list=[] url_list=[] while 1: download_line=content[content.find("<p>"):content.find("</p>")+len("</p>")] if "down_link" in download_line: seprate=unicode("、", "utf-8") last=unicode(")", "utf-8") spec=unicode("/", "utf-8") if "<span" in download_line: file_name=download_line[download_line.find('cboxElement">')+len('cboxElement">'):download_line.find('</span>')] #if seprate in file_name: #file_name=file_name[file_name.find(u"、"):] else: file_name=download_line[download_line.find('<p>')+len('<p>'):download_line.find('(<a')] #file_name=(file_name[file_name.find(u"、"):]).strip() file_name=unicode(file_name, "utf-8") if seprate in file_name: file_name=file_name[file_name.find(seprate)+len(seprate):] if last in file_name: file_name=file_name[:file_name.find(last)] if spec in file_name: file_name=file_name.replace(spec,"") file_name_list.append(file_name) #file_name_list.append(unicode(file_name, "utf-8")) url=download_line[download_line.find('http://adc'):download_line.find('" target')] url_list.append(url) if content.find("</p>")==-1: break else: content=content[content.find("</p>")+len("</p>"):] for i in range(0,len(file_name_list)): download(url_list[i],file_name_list[i])
- 批量下载淘宝 2012年ADC技术嘉年华PDF文件
- 2011~2012阿里淘宝技术嘉年华ppt打包.完整版
- 杭州ADC技术嘉年华两日总结-SOA,去C
- 无人值守的性能测试 -- for 淘宝技术嘉年华 TCon2011
- 分享一下淘宝iData技术嘉年华的几点感触
- 2012年Oracle技术嘉年华后写的“作业”
- 如何批量拆分多个PDF文件的软件下载
- 淘宝批量下载图片方法
- 用Java批量下载PDF
- 放slides了,无人值守的性能测试 for 淘宝技术嘉年华TCon2011
- 2012年阿里技术嘉年华所见所感所悟
- 【技术贴收集】在线预览下载PDF文件
- 参加oracle技术嘉年华
- 阿里技术嘉年华
- 技术嘉年华-辩论赛
- 淘宝宝贝图片批量下载教程
- 2014年Oracle技术嘉年华PPT合集(OTN 2014)
- 显示/下载PDF文件
- 15个Excel小技巧
- vim命令入门【图】
- 珍惜人生
- 开发第一个phonegap插件
- C宏定义的简单总结
- 批量下载淘宝 2012年ADC技术嘉年华PDF文件
- iOS列表vs安卓列表
- connecting scenes together to make a game
- GC的类型以及对应日志的解释
- git 使用详解(1)-- 初体验
- tomcat缓存问题java.lang.IllegalArgumentException: Document base *** does not exist or is nota readable
- windows右键添加CMD命令打开文件夹
- mysql 从ibdata1 恢复
- PHP的set_include_path函数