Python解析网页源代码中的115网盘链接实例


Posted in Python onSeptember 30, 2014

本文实例讲述了python解析网页源代码中的115网盘链接的方法。分享给大家供大家参考。具体方法分析如下:

其中的1.txt,是网页http://bbs.pediy.com/showthread.php?t=144788另存为1.txt

具体代码如下:

import re 
   
if __name__ == "__main__": 
  fp = open("c:\\1.txt") 
   
  https = re.compile(r"(http://u.*)") 
  for url in https.findall(fp.read()): 
    print url

输出结果:

http://u.115.com/file/f61cb107c8 
http://u.115.com/file/f6806f45b8 
http://u.115.com/file/f6ec42d4d3 
http://u.115.com/file/f6deb05ec4 
http://u.115.com/file/f6e51f6838 
http://u.115.com/file/f66edaf8d3  
http://u.115.com/file/f6d07e07b9 
http://u.115.com/file/f6d7f585a8 
http://u.115.com/file/f639d8b3cf 
http://u.115.com/file/f6dcadbde6 
http://u.115.com/file/f6ea3f01c1 
http://u.115.com/file/f65b96a06f  
http://u.115.com/file/f682da085a  
http://u.115.com/file/f6486e698 
http://u.115.com/file/f6b7491d9f 
http://u.115.com/file/f622b7f9a7 
http://u.115.com/file/f64e2424b9 
http://u.115.com/file/f6e5132d4d  
http://u.115.com/file/f655c10e86  
http://u.115.com/file/f6b22e64e6 
http://u.115.com/file/f6812126a4  
http://u.115.com/file/f6523e625c 
http://u.115.com/file/f63e0ccb28 
http://u.115.com/file/f611e07b8a# 
http://u.115.com/file/f6e047bccc#  
http://u.115.com/file/f6d348d781# 
http://u.115.com/file/f6ada24153# 
http://u.115.com/file/f64f97518b#  
http://u.115.com/file/f6f9ba96f8# 
http://u.115.com/file/f650e06f38# 
http://u.115.com/file/f683ee5b2a# 
http://u.115.com/file/f69009bfc2# 
http://u.115.com/file/f6ea427646# 
http://u.115.com/file/f6acdc6b7f# 
http://u.115.com/file/f6c85745d0# 
http://u.115.com/file/f61a26cf12# 
http://u.115.com/file/f631edf5c6#  
http://u.115.com/file/f6b0fa6fb8# 
http://u.115.com/file/f6f5fe8962# 
http://u.115.com/file/f6bf975e0#  
http://u.115.com/file/f6d522784c#  
http://u.115.com/file/f6b5ac9991#  
http://u.115.com/file/f62e80ced5#  
http://u.115.com/file/f6bff09c0c#  
http://u.115.com/file/f663fc4a54# 
http://u.115.com/file/blpk4pv1 
http://u.115.com/file/c4rjotdz 
http://u.115.com/file/f6a960aca8# 
http://u.115.com/file/efnn38jr 
http://u.115.com/file/c4leomjd 
http://u.115.com/file/dlpw9s6i 
http://u.115.com/file/f6d3cbebe0# 
http://u.115.com/file/f6de8062b2# 
http://u.115.com/file/ef8og8la 
http://u.115.com/file/f6f6391ac6# 
http://u.115.com/file/f628d256ae# 
http://u.115.com/file/f66a049dc9# 
http://u.115.com/file/f62bf1750a# 
http://u.115.com/file/f642e47260# 
http://u.115.com/file/f693eb7c89# 
http://u.115.com/file/f6ed68ba9b# 
http://u.115.com/file/f6f099c3f9# 
http://u.115.com/file/f61ac19339# 
http://u.115.com/file/f6f3c78d2c# 
http://u.115.com/file/f6696f6348# 
http://u.115.com/file/f6e88eeefb# 
http://u.115.com/file/f66471e4eb# 
http://u.115.com/file/f672da54ae# 
http://u.115.com/file/dnasw0kp# 
http://u.115.com/file/dnagnndx# 
http://u.115.com/file/clwr2xxg# 
http://u.115.com/file/bhbcnnwe# 
http://u.115.com/file/aq2rp9ga# 
http://u.115.com/file/e601turs# 
http://u.115.com/file/dn46qs7x# 
http://u.115.com/file/clwonrwg# 
http://u.115.com/file/dn43i7jf# 
http://u.115.com/file/bhbgrnfz# 
http://u.115.com/file/dnsl0kxp#

希望本文所述对大家的Python程序设计有所帮助

Python 相关文章推荐
python中的字典详细介绍
Sep 18 Python
Python实现多线程抓取妹子图
Aug 08 Python
在centos7中分布式部署pyspider
May 03 Python
python实现各进制转换的总结大全
Jun 18 Python
python机器学习库常用汇总
Nov 15 Python
Python实现的选择排序算法原理与用法实例分析
Nov 22 Python
python之matplotlib学习绘制动态更新图实例代码
Jan 23 Python
python中数组和矩阵乘法及使用总结(推荐)
May 18 Python
基于Django的乐观锁与悲观锁解决订单并发问题详解
Jul 31 Python
Python3 Tkinkter + SQLite实现登录和注册界面
Nov 19 Python
关于Numpy中的行向量和列向量详解
Nov 30 Python
关于python 的legend图例,参数使用说明
Apr 17 Python
python网络编程之读取网站根目录实例
Sep 30 #Python
python中sets模块的用法实例
Sep 30 #Python
python根据路径导入模块的方法
Sep 30 #Python
python基于xml parse实现解析cdatasection数据
Sep 30 #Python
python中ConfigParse模块的用法
Sep 29 #Python
Python中logging模块的用法实例
Sep 29 #Python
Python基于twisted实现简单的web服务器
Sep 29 #Python
You might like
PHP与C#分别格式化文件大小的代码
2011/05/14 PHP
php上传大文件设置方法
2016/04/14 PHP
利用ajax和PHP实现简单的流程管理
2017/03/23 PHP
PHP 观察者模式深入理解与应用分析
2019/09/25 PHP
BOM与DOM的区别分析
2010/10/26 Javascript
jQuery(1.6.3) 中css方法对浮动的实现缺陷分析
2011/09/09 Javascript
JavaScript显示当然日期和时间即年月日星期和时间
2013/10/29 Javascript
jQuery调用ajax请求的常见方法汇总
2015/03/24 Javascript
基于JS实现省市联动效果代码分享
2016/06/06 Javascript
JavaScript 函数模式详解及示例
2016/09/07 Javascript
使用jQuery实现一个类似GridView的编辑,更新,取消和删除的功能
2017/03/15 Javascript
微信小程序五星评分效果实现代码
2017/04/06 Javascript
详解微信小程序设置底部导航栏目方法
2017/06/29 Javascript
nodejs实现连接mongodb数据库的方法示例
2018/03/15 NodeJs
vue实现2048小游戏功能思路详解
2018/05/09 Javascript
在小程序开发中使用npm的方法
2018/10/17 Javascript
Vue 实现html中根据类型显示内容
2019/10/28 Javascript
python 利用文件锁单例执行脚本的方法
2019/02/19 Python
Python3.5 Pandas模块缺失值处理和层次索引实例详解
2019/04/23 Python
11个Python3字典内置方法大全与示例汇总
2019/05/13 Python
python logging模块书写日志以及日志分割详解
2019/07/22 Python
详解python算法常用技巧与内置库
2020/10/17 Python
canvas与html5实现视频截图功能示例
2016/12/15 HTML / CSS
html5 制作地图当前定位箭头的方法示例
2020/01/10 HTML / CSS
奥地利网上现代灯具和灯饰店:Lampenwelt.at
2018/01/29 全球购物
电影T恤、80年代T恤和80年代服装:TV Store Online
2020/01/05 全球购物
北大自主招生自荐信
2013/10/19 职场文书
年度考核自我鉴定
2014/03/19 职场文书
家长给学校的建议书
2014/05/15 职场文书
英语教师求职信
2014/06/16 职场文书
党员个人对照检查材料
2014/10/01 职场文书
新员工试用期自我评价
2015/03/10 职场文书
党性教育心得体会(共6篇)
2016/01/21 职场文书
《坐井观天》教学反思
2016/02/18 职场文书
《中国机长》观后感:敬畏生命,敬畏职责
2019/11/12 职场文书
HTML CSS 一个标签实现带动画的抖音LOGO
2022/04/26 HTML / CSS