fun下载内容批量收集
1.download title and url
#!/usr/bin/env python
#-*- coding:utf-8 -*- import re, urllib2,threading def geturltitle(match, file):
s = match.group();
p = re.compile(r'^\[mukio=file\]');
downurl = re.sub(p, '', s); print downurl;
# 过滤url
if downurl:
file.writelines(downurl);
file.write('\n');
# for line in downurl:
# file.write(line); # 过滤title
pattern1 = re.compile(r'<meta name="keywords" content="\S.*"');
match1 = pattern1.search(respread);
if match1:
s1 = match1.group();
p1 = re.compile(r'^<meta name="keywords" content="');
title = re.sub(p1, '', s1);
print title;
if title:
file.writelines(title);
file.write('\n\n');
# for line in title:
# file.write(line); while 1:
file = open('avfun1.txt', 'w');
for n in range(3600,9000):
try:
resp = urllib2.urlopen('http://www.avfun1.com/forum.php?mod=viewthread&tid='+repr(n)+'&mobile=yes', timeout = 2);
respread = resp.read();
pattern = re.compile(r'\[mukio=file\]\S.*mp4');
match = pattern.search(respread);
print "pid = " + repr(n) if match:
threading.Thread(target=geturltitle(match, file)).start();
# else:
# continue;
pass
except Exception, e:
print e;
pass
else:
pass
finally:
pass
file.close();
break;
2.rename title from file
#!/usr/bin/env python
#-*- coding:utf-8 -*- import re, os dir = "/Users/apple/Downloads/avfun1/" #文件目录 if os.path.isdir(dir): #检验目录是否有误
print ("Directory exists!")
else:
print ("Directory not exist.") filelist=os.listdir(dir+'aaa') file = open(dir+'avfun1.txt', 'rb'); dir = dir + 'aaa' '''for line in file:
print line
'''
str = file.read() for name in filelist:
match = re.search(name+r'\n\S.*', str) if match:
str1 = match.group();
tt_match = re.search(r'[^\d.mp4\n].*$', str1) newfile = tt_match.group()+'.mp4' #获取匹配名存为newfile
print name
print newfile
os.rename(os.path.join(dir,name),os.path.join(dir,newfile))
else:
print match
fun下载内容批量收集的更多相关文章
- 向linux服务器上传下载文件方式收集
向linux服务器上传下载文件方式收集 1. scp [优点]简单方便,安全可靠:支持限速参数[缺点]不支持排除目录[用法] scp就是secure copy,是用来进行远程文件拷贝的.数据传输使用 ...
- (转)libcurl应用:如何把下载内容写入内存
libcurl应用:如何把下载内容写入内存 2008-01-13 00:32:52| 分类: 默认分类 |举报 |字号 订阅 libcurl的文档中有 getinmemory.c这个例子,把下载 ...
- EasyUI form ajax submit到MVC后,在IE下提示下载内容的解决办法
问题描述: 项目环境为,.Net Mvc5+EF6……前端框架使用的是EasyUI v1.4.4. 在视图页面中,使用form的submit方法提交表单数据时,如果是使用IE的话,请求成功后IE会提示 ...
- API例子:用Java/JavaScript下载内容提取器
1,引言 本文讲解怎样用Java和JavaScript使用 GooSeeker API 接口下载内容提取器,这是一个示例程序.什么是内容提取器?为什么用这种方式?源自Python即时网络爬虫开源项目: ...
- chrome浏览器下载内容存放位置
点击: 或者直接快捷键 ctrl +J 打开下载的资料在[设置]中可将浏览器设置成默认浏览器,更换下载内容的存放位置:给一个提示,本人未曾修改下载的存放位置,是用户/Administrator/Dow ...
- PDF文本内容批量提取到Excel
QQ:231469242,版权所有 sklearn实战-乳腺癌细胞数据挖掘 https://study.163.com/course/introduction.htm?courseId=1005269 ...
- 2018-11-8-WPF-获取下载内容长度
title author date CreateTime categories WPF 获取下载内容长度 lindexi 2018-11-08 20:18:15 +0800 2018-11-08 20 ...
- shell脚本批量收集linux服务器的硬件信息快速实现
安装ansible批量管理系统.(没有的话,ssh远程命令循环也可以) 在常用的数据库里面新建一张表,用你要收集的信息作为列名,提供可以用shell插入.
- nodejs读取excel内容批量替换并生成新的html和新excel对照文件
因为广告投放需要做一批对外投放下载页面,由于没有专门负责填充页面的编辑同学做,只能前端来做了, 拿到excel看了一下,需要生成200多个文件,一下子懵逼了. 这要是来回复制粘贴太low了 正好最新用 ...
随机推荐
- sql server 2008 R2 升级与安装遇到的问题
因工作需要,遂把以前的2008升级到r2,升级失败,具体原因忘了,卸载2008,清了注册表删了文件,结果安装的时候失败了,如下图: 下一步-有错误日志和错误的序列号,错误日志在C:\Program F ...
- jQuery EasyUI API 中文文档 - Tree树使用介绍
用 $.fn.tree.defaults 重写了 defaults. 依赖 draggable droppable 用法 Tree 能在 <ul> 元素里定义,此标记可以定义为叶节点和子节 ...
- Linux useradd 添加用户
在 linux 中,如果我们想添加一个用户,那么使用的命令如下: 用户管理命令: useradd 基础的命令 命令名称:useradd 命令的所在路径:/usr/bin/useradd 执行权限:ro ...
- 51nod1010【二分】
打表+二分 #include <bits/stdc++.h> using namespace std; typedef long long LL; const LL inf=1e18+10 ...
- Unity3D研究院之IOS Android支持中文与本地文件的读取写
前几天有个朋友问我为什么在IOS平台中可以正常的读写文件可是在Android平台中就无法正常的读写.当时因为在上班所以我没时间来帮他解决,晚上回家后我就拿起安卓手机真机调试很快就定位问题所在,原 ...
- hyperledger fabric 1.0.5 分布式部署 (一)
环境是个人虚拟机ubuntu 16.04 64 位版本 前期用户需要先安装好:gcc.g++.git 软件 安装 golang 首先给环境安装一个 go 语言环境,版本最好在1.8 以上 golang ...
- GPDB外部表创建示例
创建以|为分隔符的外部表CREATE EXTERNAL TABLE ext_expenses ( name text,date date, amount float4, category text, ...
- springMVC 类型转换
springMVC 类型转换 https://www.cnblogs.com/hafiz/p/5812873.html
- python操作rabbitmq实现广播效果
生产方(Fanout_Publisher.py) # __author__ = 'STEVEN' import pika #开启socket connection = pika.BlockingCon ...
- 线段树-区间更新-HDU 1689
#include <iostream> #include <cstdio> #include <string> #include <cstring> # ...