From a8d1c68aba4385ec6bcf86f6a8734a0b6ea881ff Mon Sep 17 00:00:00 2001 From: Songrui <1778280163@qq.com> Date: Fri, 29 May 2026 01:41:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=20'src/main/java/com/example?= =?UTF-8?q?/datacollect/command/CrawlCommand.java'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datacollect/command/CrawlCommand.java | 42 ------------------- 1 file changed, 42 deletions(-) delete mode 100644 src/main/java/com/example/datacollect/command/CrawlCommand.java diff --git a/src/main/java/com/example/datacollect/command/CrawlCommand.java b/src/main/java/com/example/datacollect/command/CrawlCommand.java deleted file mode 100644 index 66f2115..0000000 --- a/src/main/java/com/example/datacollect/command/CrawlCommand.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.example.datacollect.command; - -import com.example.datacollect.model.Article; -import com.example.datacollect.view.ConsoleView; -import java.util.List; -import java.util.regex.Pattern; - -public class CrawlCommand implements Command { - private static final String URL_REGEX = "^(https?|ftp)://[^\\s/$.?#].[^\\s]*$"; - private static final Pattern URL_PATTERN = Pattern.compile(URL_REGEX); - - private final ConsoleView view; - - public CrawlCommand(ConsoleView view) { - this.view = view; - } - - @Override - public String getName() { - return "crawl"; - } - - @Override - public void execute(String[] args, List
articles) { - if (args.length < 2) { - view.printError("Usage: crawl "); - return; - } - - String url = args[1]; - if (!isValidUrl(url)) { - view.printError("Invalid URL format: " + url); - return; - } - - view.printInfo("Stub: would crawl " + url); - } - - private boolean isValidUrl(String url) { - return url != null && URL_PATTERN.matcher(url).matches(); - } -}