
批處理文件如何從雜亂的網(wǎng)頁源代碼總提取所需圖片地址并保存如何從雜亂的網(wǎng)頁源代碼總提取所需圖片地址并保存?我這有某網(wǎng)站的源代碼文件1.txt~100.txt,一下是1.txt的其中的一部分:
我需要提取整個文件中所有以類似:nclick="copycode($('code0'));">復(fù)制代碼
- href=http://www.topit.me/item/2277171>12964667477319</a></div><div class=info></div></div><a href=http://www.topit.me/item/2277171><img id=item_d_2277171 class=img alt=12964667477319 width=245px height=200px src=http://img.topit.me/m/01/31/12964667477319.jpg /></a></div><div class=e m><div class=hover bar><div class=heartbtn><a id=item_heart_771744 class=heart nologin href=http://www.topit.me/login?ref=%2Ftag%2FComic%3Fp%3D1><span>heart</span></a></div><div class=title><a href=http://www.topit.me/item/771744>12416993</a></div><div class=info></div></div><a href=http://www.topit.me/item/771744><img id=item_d_771744 class=img alt=12416993 width=245px height=200px src=http://img.topit.me/m/08/14/12817636911240.jpg /></a></div><div class=e m><div class=hover bar><div class=heartbtn><a id=item_heart_533918 class=heart nologin href=http://www.topit.me/login?ref=%2Ftag%2FComic%3Fp%3D1><span>heart</span></a></div><div class=title><a href=http://www.topit.me/item/533918>Ⅶ</a></div><div class=info></div></div><a href=http://www.topit.me/item/533918><img id=item_d_533918 class=img alt=Ⅶ width=245px height=200px src=http://www.cn-boutiq.com/skin/default/image/nopic.gif /></a></div><div class=e m><div class=hover bar><div class=heartbtn><a id=item_heart_2324230
格式的圖片地址(有些地址可能不在同一行中)保存到到List.txt文件中,效果如下:nclick="copycode($('code1'));">復(fù)制代碼
- http://img.topit.me/m/08/14/12817636911240.jpg
同時我在論壇里找到了榮譽版主namejm大大的類似功能的代碼,但是卻不能解決我的問題,希望大家修改一下:nclick="copycode($('code2'));">復(fù)制代碼
- http://img.topit.me/m/01/31/12964667477319.jpg
- http://img.topit.me/m/08/14/12817636911240.jpg
- http://img.topit.me/m/07/14/12791168666293.jpg
- 。
- 。
- 。
nclick="copycode($('code3'));">復(fù)制代碼
- @echo off
- cd.>list.txt
- for %%i in (*.htm) do (
- (echo.&echo %%i 中的圖片&echo.)>>list.txt
- for /f delims= %%j in ('findstr /i src=.*http://.*.jpg %%i 2^>nul') do (
- set str=%%j
- setlocal enabledelayedexpansion
- set str=!str:=!
- set str=!str:*src=!
- for /f delims==> %%k in (!str!) do echo %%k>>list.txt
- endlocal
- )
- )
- start list.txt

