From a8f68953812b354dd2e61f174772abaf9441e063 Mon Sep 17 00:00:00 2001 From: HuangZhikai <386754646@qq.com> Date: Sun, 31 May 2026 14:52:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20'project/model'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/model/CrawlerConfig.java | 46 +++++++++++++++++++++ project/model/CrawlerData.java | 68 ++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 project/model/CrawlerConfig.java create mode 100644 project/model/CrawlerData.java diff --git a/project/model/CrawlerConfig.java b/project/model/CrawlerConfig.java new file mode 100644 index 0000000..aff2fc7 --- /dev/null +++ b/project/model/CrawlerConfig.java @@ -0,0 +1,46 @@ +package com.crawler.model; + +public class CrawlerConfig { + private String targetUrl; + private String userAgent; + private int timeout; + private int retryCount; + + public CrawlerConfig() { + this.userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"; + this.timeout = 30000; + this.retryCount = 3; + } + + public String getTargetUrl() { + return targetUrl; + } + + public void setTargetUrl(String targetUrl) { + this.targetUrl = targetUrl; + } + + public String getUserAgent() { + return userAgent; + } + + public void setUserAgent(String userAgent) { + this.userAgent = userAgent; + } + + public int getTimeout() { + return timeout; + } + + public void setTimeout(int timeout) { + this.timeout = timeout; + } + + public int getRetryCount() { + return retryCount; + } + + public void setRetryCount(int retryCount) { + this.retryCount = retryCount; + } +} \ No newline at end of file diff --git a/project/model/CrawlerData.java b/project/model/CrawlerData.java new file mode 100644 index 0000000..9e53852 --- /dev/null +++ b/project/model/CrawlerData.java @@ -0,0 +1,68 @@ +package com.crawler.model; + +public class CrawlerData { + private String title; + private String content; + private String url; + private String source; + private String publishDate; + + public CrawlerData() {} + + public CrawlerData(String title, String content, String url, String source) { + this.title = title; + this.content = content; + this.url = url; + this.source = source; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getPublishDate() { + return publishDate; + } + + public void setPublishDate(String publishDate) { + this.publishDate = publishDate; + } + + @Override + public String toString() { + return "CrawlerData{" + + "title='" + title + '\'' + + ", url='" + url + '\'' + + ", source='" + source + '\'' + + ", publishDate='" + publishDate + '\'' + + '}'; + } +} \ No newline at end of file