diff --git a/webmagic-core/src/main/java/us/codecraft/webmagic/processor/example/ZhihuPageProcessor.java b/webmagic-core/src/main/java/us/codecraft/webmagic/processor/example/ZhihuPageProcessor.java index a2a17e8..4c94eef 100644 --- a/webmagic-core/src/main/java/us/codecraft/webmagic/processor/example/ZhihuPageProcessor.java +++ b/webmagic-core/src/main/java/us/codecraft/webmagic/processor/example/ZhihuPageProcessor.java @@ -16,9 +16,9 @@ public class ZhihuPageProcessor implements PageProcessor { @Override public void process(Page page) { page.addTargetRequests(page.getHtml().links().regex("https://www\\.zhihu\\.com/question/\\d+/answer/\\d+.*").all()); - page.putField("title", page.getHtml().xpath("//h2[@class='zm-item-title']/a/text()").toString()); - page.putField("question", page.getHtml().xpath("//div[@id='zh-question-detail']//tidyText()").toString()); - page.putField("answer", page.getHtml().xpath("//div[@id='zh-question-answer-wrap']//div[@class='zm-editable-content']/tidyText()").toString()); + page.putField("title", page.getHtml().xpath("//h1[@class='QuestionHeader-title']/text()").toString()); + page.putField("question", page.getHtml().xpath("//div[@class='QuestionRichText']//tidyText()").toString()); + page.putField("answer", page.getHtml().xpath("//div[@class='QuestionAnswer-content']/tidyText()").toString()); if (page.getResultItems().get("title")==null){ //skip this page page.setSkip(true);