shell bash脚本批量wget下载页面上的图片

为了获取某个国外网站的模板(国外的设计师真的很赞),尝试靠wget抓取网页。其中有部分图片在js文件中标注,如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
;(function( $, window, document, undefined ) {

    var Customizer = function( ) {
        this.init();
    }

    Customizer.prototype = {

        patterns: [
            'assets/images/layout/bg/arches.png',
            'assets/images/layout/bg/blu_stripes.png',
            'assets/images/layout/bg/bright_squares.png',
            'assets/images/layout/bg/brushed_alu.png',
            'assets/images/layout/bg/circles.png',
            'assets/images/layout/bg/climpek.png',
            'assets/images/layout/bg/connect.png',
            'assets/images/layout/bg/corrugation.png',
            'assets/images/layout/bg/cubes.png',
            'assets/images/layout/bg/diagonal-noise.png',
            'assets/images/layout/bg/diagonal_striped_brick.png',
            'assets/images/layout/bg/diamonds.png',
            'assets/images/layout/bg/diamond_upholstery.png',
            'assets/images/layout/bg/escheresque.png',
            'assets/images/layout/bg/fabric_plaid.png',
            'assets/images/layout/bg/furley_bg.png',
            'assets/images/layout/bg/gplaypattern.png',
            'assets/images/layout/bg/gradient_squares.png',
            'assets/images/layout/bg/grey.png',

bash脚本如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
# Bash for download png file

text="png.list"
url="http://www.xxx.com/xxx/assets/images/layout/bg"
# ==============================================
# Function
# ==============================================
man {
while read line
    do
    echo -e "$line"
    wget -q $url/$line
done < $text
}

# ==============================================
# Action
# ==============================================
man
原文链接:https://xiaohost.com/1315.html,转载请注明出处。
0

评论0

请先