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. jQuery基础教程-第8章-001Adding new global functions

    一. 1.To add a function to the jQuery namespace, we can just assign the new function asa property of ...

  2. 屌爆的xamarin,一人单挑google/apple/windows

    一个IDE就把3大手机平台全包了: android:自带模拟器xamarin player,速度堪比genymotion. ios:需要一台mac机辅助,一旦配好后可全程脱离,连ios模拟器都给镜像到 ...

  3. Java IO输入输出流File 字节流

    public static void main(String[] args) throws IOException { //创建源 File f =new File("file/stream ...

  4. 编写高质量代码改善C#程序的157个建议——建议34:为泛型参数设定约束

    建议34:为泛型参数设定约束 “约束”这个词可能会引起歧义,有些人肯能认为对泛型参数设定约束是限制参数的使用,实际情况正好相反.没有“约束”的泛型参数作用很有限,倒是“约束”让泛型参数具有了更多的行为 ...

  5. DataType--类型基础

    数据类型数据的定义在各种场合均不一样,数据的载体也不一样,数据的表现方式和传递方式也不一样,数据的处理方式也不一样,数据库不可能处理所有形式的数据,因此必须规范数据,按照类型划分和处理. 连续和离散( ...

  6. Ajax GET

    $ajax的post请求提交方式: Controller: @RequestMapping("/emps") @ResponseBody public Msg getEmps(@R ...

  7. SSM项目配置文件及其各项使用

    $说明: ·Spring 5  + Mybatis 3.4.5 +SpringMVC  ·使用druid数据库 ·使用log4j输出日志 $Spring 及其配置文件(部分) Spring官方网站:h ...

  8. 「CF 600E」 Lomsat gelral

    题目链接 戳我 \(Describe\) 给出一棵树,每个节点有一个颜色,求每个节点的子树中颜色数目最多的颜色的和. \(Solution\) 这道题为什么好多人都写的是启发式合并,表示我不会啊. 这 ...

  9. LoadRunner---杂问题&接口测试

    问题1] 响应时间是系统完成事务执行准备后所采集的时间戳和系统完成待执行事务后所采集的时间戳之间的时间间隔,是衡量特定类型应用事务性能的重要指标,标志了用户执行一项操作大致需要多长时间.[问题2] 系 ...

  10. SKU:唯一标识填什么

    策略 随意填写 只要别和别人重复就好 ,不过重复你也创建不了. 最好填与APP信息相关的,比如直接填写bundle ID 上去...跟套装ID保持一致. 你新建应用的时候都还没有APP ID 你怎么填 ...