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