You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
919 B
33 lines
919 B
package strategy;
|
|
|
|
import model.Article;
|
|
import util.HttpUtil;
|
|
import exception.SpiderException;
|
|
|
|
public class JjwxcStrategy implements CrawlStrategy {
|
|
@Override
|
|
public String getName() {
|
|
return "晋江文学城";
|
|
}
|
|
|
|
@Override
|
|
public String getUrl() {
|
|
return "https://www.jjwxc.net/";
|
|
}
|
|
|
|
@Override
|
|
public Article crawl() throws SpiderException {
|
|
String html = HttpUtil.get(getUrl(), "GB18030");
|
|
|
|
String title = HttpUtil.extractTagSafe(html, "<title>", "</title>");
|
|
String description = "晋江文学城(www.jjwxc.net)创立于2003年8月,是具备相当规模女性网络文学原创基地";
|
|
|
|
Article article = new Article();
|
|
article.setTitle(title);
|
|
article.setContent(description);
|
|
article.setUrl(getUrl());
|
|
article.setSource(getName());
|
|
|
|
return article;
|
|
}
|
|
}
|
|
|