⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 changelargeimagename.java

📁 Light in the box 抓取程序。 使用HttpClient
💻 JAVA
字号:
package com.blogool.crawl;

import java.io.*;
import java.util.*;
import java.util.regex.*;


import com.blogool.crawl.lib.*;

public class ChangeLargeImageName {
	public static void main(String[] args) throws Exception {
		Map<String, String> slMap = new HashMap<String, String>();
		
		File[] files = new File("d:/libox1/items").listFiles();
		
		Pattern slExist = Pattern.compile("<div\\s+class=\"part3_left\">(.+?)</div>");
		Pattern sl = Pattern.compile("<a\\s*href=\"javascript:changeMainImageSrc\\('(.+?)'\\);\">\\s*<img src=\"(.+?)\"\\s*alt=");
		
		for (int i = 0; i < files.length; i ++) {
			File f = files[i];
			String content = Util.getContentOrignal(f);
			
			Matcher m = slExist.matcher(content);
			if (m.find()) {
				String str = m.group(1);
				
				m = sl.matcher(str);
				while (m.find()) {
					String strLarge = m.group(1);
					String strSmall = m.group(2);
					if (!strLarge.equals(strSmall.replaceAll("/s/", "/l/"))) {
						slMap.put(strSmall, strLarge);
					}
				}
				
				
			}
		}
		
		System.out.println(slMap.size());
		
		/*
		Cat root = Util.loadCat(new File("d:/libox1/cats4.xml"));
		
		for (int i = 0; i < root.getCats().size(); i ++) {
			Cat c = root.getCats().get(i);
			for (int j = 0; j < c.getCats().size(); j ++) {
				Cat cat = c.getCats().get(j);
				List<Item> list = cat.getItems();
				if (list == null) continue;
				for (int k = 0; k < list.size(); k ++) {
					Item item = list.get(k);
				}
			}
		}*/
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -