中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net  论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

游客:  注册 | 登录 | 命令行 | 会员 | 搜索 | 上传 | 帮助 »
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [原创]批量智能下载网页图片[抛砖]
« [1] [2] »
作者:
标题: [原创]批量智能下载网页图片[抛砖] 上一主题 | 下一主题
ngd
中级用户

拟谷盗


积分 312
发帖 108
注册 2007-1-21
状态 离线
『第 16 楼』:  curl和sed的问题


curl "http://220.181.38.82/m?ct=134217728&tn=baidusg,不得不爱  &word=mp3,http://www.yantaiblog.net/UploadFiles/2007-7/aGhmbGtmbGsx.mp3,,[%B2%BB%B5%C3%B2%BB%B0%AE]&si=%B2%BB%B5%C3%B2%BB%B0%AE;;%C5%CB%E7%E2%B0%D8;;51913;;51913&lm=16777216"
curl: (3) [globbing] illegal character in range specification at pos 132
总感觉curl在某些方面有很多缺陷,为何出现这样的情况?
有时 url中 有 & 字符时必需使用在 & 前加转义字符,而有些时候却不需要,为何?
curl http://list.mp3.baidu.com/topso/mp3topsong.html | sed "s/\x22/\xa/g;/baidump3/!d"

curl http://list.mp3.baidu.com/topso/mp3topsong.html | sed "s/\x22/\xa/g" | sed "/baidump3/!d"
这2个命令执行的结果为何不一样?



FLOSS
2008-3-17 00:48
查看资料  发短消息 网志   编辑帖子  回复  引用回复
junchen2
高级用户





积分 537
发帖 219
注册 2007-8-4
来自 杭州--半山
状态 离线
『第 17 楼』:  

总感觉curl在某些方面有很多缺陷,为何出现这样的情况?
有时 url中 有 & 字符时必需使用在 & 前加转义字符,而有些时候却不需要,为何?
--------------------------
1我想应该跟CMD.EXE语法分析有关,cmd碰到&它认为是一个语句的结束。


这2个命令执行的结果为何不一样?
--------------------------------------------
2。sed 是以行为单位进行读取数据的。大概过程是提取curl里的一行数据读取后的内容存放在pattern space。经过 sed "s/\x22/\xa/g" 处理后,貌似生成了多行,实际上它仍然存储在pattern space,作为一个未加工完的半成品,/baidump3/!d 再对其进行处理。
反正记住
sed对它输入的数据是采取一行行读的,输入可能是以管道,文件,进程中的通信等方式。
pattern space的内容是不会以 输入 那样对待的。

[ Last edited by junchen2 on 2008-3-17 at 01:54 PM ]

2008-3-17 13:53
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
vkill
金牌会员





积分 4103
发帖 1744
注册 2006-1-20
来自 甘肃.临泽
状态 离线
『第 18 楼』:  

像from提交的网页用 wget 和 curl 都可以解决,两个都试下就好了

2008-3-18 16:24
查看资料  发送邮件  访问主页  发短消息 网志   编辑帖子  回复  引用回复
knoppix7
银牌会员





积分 1287
发帖 634
注册 2007-5-2
来自 cmd.exe
状态 离线
『第 19 楼』:  

D:\>wget "http://mp3.baidu.com/u?u=http://www.yantaiblog.net/UploadFiles/2007-7/
aGhmbGtmbGsx.mp3"
--17:52:54--  http://mp3.baidu.com/u?u=http:// ... net/UploadFiles/200
7-7/aGhmbGtmbGsx.mp3
           => `u@u=http:%2F%2Fwww.yantaiblog.net%2FUploadFiles%2F2007-7%2FaGhmbG
tmbGsx.mp3'
Resolving mp3.baidu.com... done.
Connecting to mp3.baidu.com[61.135.163.222]:80... connected.
HTTP request sent, awaiting response... 302 Object moved
Location: http://www.yantaiblog.net/UploadFiles/2007-7/76386053.mp3 [following]
--17:52:55--  http://www.yantaiblog.net/UploadFiles/2007-7/76386053.mp3
           => `76386053.mp3'
Resolving www.yantaiblog.net... done.
Connecting to www.yantaiblog.net[222.135.144.5]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4,505,113 [audio/mpeg]

0% [                                     ] 19,433         9.56K/s    ETA 07:38

2008-3-18 19:02
查看资料  发短消息 网志   编辑帖子  回复  引用回复
zerocq
中级用户




积分 458
发帖 196
注册 2006-10-5
状态 离线
『第 20 楼』:  

楼主能否解释一下curl的keepalive选项该在什么情况下使用,如何使用

谢谢

2008-3-18 19:12
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
ngd
中级用户

拟谷盗


积分 312
发帖 108
注册 2007-1-21
状态 离线
『第 21 楼』:  



  Quote:
Originally posted by zerocq at 2008-3-18 19:12:
楼主能否解释一下curl的keepalive选项该在什么情况下使用,如何使用

谢谢

没用过 keepalive方式的
参考
curl --manual
http://curl.haxx.se/docs/manpage.html

--keepalive-time <seconds>

This option sets the time a connection needs to remain idle before sending keepalive probes and the time between individual keepalive probes. It is currently effective on operating systems offering the TCP_KEEPIDLE and TCP_KEEPINTVL socket options (meaning Linux, recent AIX, HP-UX and more). This option has no effect if --no-keepalive is used. (Added in 7.18.0)

If this option is used multiple times, the last occurrence sets the amount.

[ Last edited by ngd on 2008-4-19 at 05:15 PM ]



FLOSS
2008-3-18 21:07
查看资料  发短消息 网志   编辑帖子  回复  引用回复
ngd
中级用户

拟谷盗


积分 312
发帖 108
注册 2007-1-21
状态 离线
『第 22 楼』:  



  Quote:
Originally posted by knoppix7 at 2008-3-18 19:02:
D:\>wget "http://mp3.baidu.com/u?u=http://www.yantaiblog.net/UploadFiles/2007-7/
aGhmbGtmbGsx.mp3"
--17:52:54--  [url]http://mp3.baidu.com/u?u=http://www.yantaiblog.net/UploadFiles/2 ...

奇怪!wget 1.10.2
D:\>wget "http://mp3.baidu.com/u?u=http://www.yantaiblog.net/UploadFiles/2007-7/
aGhmbGtmbGsx.mp3"
--20:32:27--  http://mp3.baidu.com/u?u=http:// ... net/UploadFiles/200
7-7/aGhmbGtmbGsx.mp3
           => `u@u=http%3A%2F%2Fwww.yantaiblog.net%2FUploadFiles%2F2007-7%2FaGhm
bGtmbGsx.mp3'
Resolving mp3.baidu.com... 220.181.38.70
Connecting to mp3.baidu.com|220.181.38.70|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://www.baidu.com/search/error.html [following]
--20:32:28--  http://www.baidu.com/search/error.html
           => `error.html'
Resolving www.baidu.com... 220.181.6.6, 220.181.37.55
Connecting to www.baidu.com|220.181.6.6|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2,699 (2.6K) [text/html]

100%[====================================>] 2,699         --.--K/s

20:32:38 (52.95 MB/s) - `error.html' saved [2699/2699]



FLOSS
2008-3-18 21:46
查看资料  发短消息 网志   编辑帖子  回复  引用回复
knoppix7
银牌会员





积分 1287
发帖 634
注册 2007-5-2
来自 cmd.exe
状态 离线
『第 23 楼』:  

D:\>wget --help
GNU Wget 1.8.2, a non-interactive network retriever.

2008-3-19 19:41
查看资料  发短消息 网志   编辑帖子  回复  引用回复
kioskboy
初级用户





积分 153
发帖 103
注册 2008-3-27
状态 离线
『第 24 楼』:  

curl -d "UserName=***&Password=******" http://www.netyi.net/jsLoginStatus.aspx
怎么登陆不了

2008-8-8 11:38
查看资料  发短消息 网志   编辑帖子  回复  引用回复
« [1] [2] »
请注意:您目前尚未注册或登录,请您注册登录以使用论坛的各项功能,例如发表和回复帖子等。


可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题



论坛跳转: