Object.extend=function(props){
//继承父类
var prototype=Object.create(this.prototype)
//初始化函数ctor
var _Class=function(){
if (this.ctor)
this.ctor.apply(this, arguments);
}
//当前类属性和方法
for(var k in props){
prototype[k]= props[k]
}
_Class.prototype = prototype;
//类继承
_Class.extend=this.extend;
//类扩展
_Class.expand = function (prop) {
for (var name in prop) {
prototype[name] = prop[name];
}
};
return _Class } var AutoStr=Object.extend({
str:"",
start:0,
length:0,
ctor:function(str){
var the=this
this.str=str
str.replace(/\[(.)-(.)\]/,function(m,p1,p2){
the.start=p1.charCodeAt(0)
the.length=p2.charCodeAt(0)-the.start+1
})
},
eq:function(n){
return this.str.replace(/\[(.)-(.)\]/,String.fromCharCode(this.start+n))
}
})
var d=new AutoStr("http://www.baidu.com/[a-z].html")
for(var i=0;i< d.length;i++){
console.log(d.eq(i))
}
//var d=new AutoStr("http://www.baidu.com/[0-9][0-2].html")
//for(var i=0;i< d.length;i++){
// var v=new AutoStr(d.eq(i))
// for(var j=0;j< v.length;j++){
// console.log(v.eq(j))
// }
//}

  

http://www.baidu.com/a.html
http://www.baidu.com/b.html
http://www.baidu.com/c.html
http://www.baidu.com/d.html
http://www.baidu.com/e.html
http://www.baidu.com/f.html
http://www.baidu.com/g.html
http://www.baidu.com/h.html
http://www.baidu.com/i.html
http://www.baidu.com/j.html
http://www.baidu.com/k.html
http://www.baidu.com/l.html
http://www.baidu.com/m.html
http://www.baidu.com/n.html
http://www.baidu.com/o.html
http://www.baidu.com/p.html
http://www.baidu.com/q.html
http://www.baidu.com/r.html
http://www.baidu.com/s.html
http://www.baidu.com/t.html
http://www.baidu.com/u.html
http://www.baidu.com/v.html
http://www.baidu.com/w.html
http://www.baidu.com/x.html
http://www.baidu.com/y.html
http://www.baidu.com/z.html

爬虫之自动生成url的更多相关文章

  1. stark组件开发之自动生成URL

    app01\model.py from django.db import models # Create your models here. class Depart(models.Model): i ...

  2. stark - 3 ⇲自动生成URL及视图

    以往建立了一张表,需要 1.为每张表创建4个url 2.为每张表创建4个视图函数 urlpatterns = [ url('^role/list/$',role.role_list,name='rol ...

  3. stark组件(1):动态生成URL

    项目启动时自动生成URL 效果图: 知识点: Django启动前通过apps下的ready方法执行一个可以生成URL的py文件 include函数主要返回有三个元素的一个元组.第一个是url配置(ur ...

  4. 第三百二十六节,web爬虫,scrapy模块,解决重复ur——自动递归url

    第三百二十六节,web爬虫,scrapy模块,解决重复url——自动递归url 一般抓取过的url不重复抓取,那么就需要记录url,判断当前URL如果在记录里说明已经抓取过了,如果不存在说明没抓取过 ...

  5. 五 web爬虫,scrapy模块,解决重复ur——自动递归url

    一般抓取过的url不重复抓取,那么就需要记录url,判断当前URL如果在记录里说明已经抓取过了,如果不存在说明没抓取过 记录url可以是缓存,或者数据库,如果保存数据库按照以下方式: id URL加密 ...

  6. (转)php 根据url自动生成缩略图并处理高并发问题

    分享是一种精神,与技术高低无关!   图片缩略图动态生成- [代码编程] 2011-08-23 版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明http://www.blogbus.c ...

  7. Eclipse 使用mybatis generator插件自动生成代码

    Eclipse 使用mybatis generator插件自动生成代码 标签: mybatis 2016-12-07 15:10 5247人阅读 评论(0) 收藏 举报 .embody{ paddin ...

  8. MyBatis Generator作为maven插件自动生成增删改查代码及配置文件例子

    什么是MyBatis Generator MyBatis Generator (MBG) 是一个Mybatis的代码生成器,可以自动生成一些简单的CRUD(插入,查询,更新,删除)操作代码,model ...

  9. 【krpano】二维码自动生成插件(源码+介绍+预览)

    简介 在krpano生成的全景支持HTML5在手机中展示,而在手机中打开全景网址时不方便,需要输入网址. 最近研究了如何让krpano全景根据自己当前的网址,自动生成二维码,并在电脑浏览时,可以展示出 ...

随机推荐

  1. 在Linux中监视IO性能

    dd命令 iostat命令 理解iostat的各项输出 iostat的应用实例 附:在Windows中监视IO性能 延伸阅读 dd命令 dd其实是工作于比较低层的一个数据拷贝和转换的*nix平台的工具 ...

  2. iOS play video

    iOS: How to use MPMoviePlayerController up vote6down votefavorite 3 I've created a blank project (iO ...

  3. try catch finally的用法

    http://hi.baidu.com/vincentwen/blog/item/b92d0923f1e4c64793580757.html try catch finally 1.将预见可能引发异常 ...

  4. sqlserver跨服务器查询

    两个sqlserver数据库在不同的服务器上如何插入数据哪? EXEC sp_configure RECONFIGURE EXEC sp_configure RECONFIGURE INSERT IN ...

  5. 小程序上传多图片多附件多视频 c#后端

    前言: 最近在研究微信小程序,本人自己是C#写后端的;感觉小程序挺好玩的,就自己研究了一下:刚好今天又给我需求,通过小程序上传多图 然后C#后端保存到服务器: 用NET明白 前端上传需要用到流,然后就 ...

  6. 《spring 攻略》笔记1

    chapter1 spring简介 两种spring ioc容器实现类型: BeanFactory ApplicationContext 应用程序上下文 DI技巧: @Autowired(requir ...

  7. NSURLConnection 网络请求

    前言 DEPRECATED: The NSURLConnection class should no longer be used. NSURLSession is the replacement f ...

  8. Selenium辅助工具

    下载Firefox39.0版本浏览器,安装firebug和FirePath.最新版的Firefox在扩展组件中无法找到firebug,可以使用旧的版本的Firefox浏览器. FirePath插件的使 ...

  9. oracle重新编译所有invalid objects

    点第一个,按住shift键点最后一个,右键recompile就OK了

  10. weblogic启动一闪而过

    点击startWebLogic.cmd的时候,一闪而过 我的原因:JAVA_HOME中的路径是不能带有空格:我的电脑是64位的,jdk(32位)安装路径默认带有空格还有括号,所以重新装jdk,装在没有 ...