根据搜索结果下载驱动之家某型号笔记本驱动程序

以Sony VGN-CR31这款为例,本脚本(实为命令集,笔者注)通过分析搜索页面、下载页面,最后将结果存放于相应文件(drivers_*.txt)中,同时并下载相应文件。详细见源文件:

#!/bin/bash

mkdir drivers
cd drivers/
echo > /tmp/zgq.txt
echo -n > drivers_url.txt
echo > drivers_id.txt
echo > drivers_title.txt

for i in $(seq 1 4); do
        curl http://drivers.mydrivers.com/drivers-1102-875-Sony/VGN-CR31/0-0-0-0/$i >> /tmp/zgq.txt
done

iconv -f gbk -t utf8 /tmp/zgq.txt > /tmp/zgq_1.txt

cat /tmp/zgq_1.txt | grep '<a href="/drivers/' | awk -F'</a>' '{print $1}' | grep desc > /tmp/zgq.txt

cat /tmp/zgq.txt | awk -F\/ '{print $3}' > drivers_id.txt
cat /tmp/zgq.txt | awk -F'>' '{print $3}' > drivers_title.txt


for i in `cat drivers_id.txt`; do
        curl http://drivers.mydrivers.com/download/$i > /tmp/zgq.txt 2>/dev/null
        cat /tmp/zgq.txt | grep dizhi | awk -F\" '{print $6}' | awk -F= '{print $3}' | head -n 1 >> drivers_url.txt
done

wget -i drivers_url.txt -N

注:本文章仅供学习研究之用,切勿用作非法用途,否则后果自负。
吃水不忘打井人,还是建议多点点人家的广告,如果有时间的话。:)

19 thoughts on “根据搜索结果下载驱动之家某型号笔记本驱动程序

发表评论