Home >Java >javaTutorial >Write Java Zhihu crawler with zero foundation to obtain content recommended by Zhihu editors (4)

Write Java Zhihu crawler with zero foundation to obtain content recommended by Zhihu editors (4)

黄舟
黄舟Original
2016-12-24 11:31:431184browse

The last main method is responsible for calling

import java.util.ArrayList;
public class Main {
 public static void main(String[] args) {
  // 定义即将访问的链接
  String url = "http://www.zhihu.com/explore/recommendations";
  // 访问链接并获取页面内容
  String content = Spider.SendGet(url);
  // 获取该页面的所有的知乎对象
  ArrayList<Zhihu> myZhihu = Spider.GetZhihu(content);
  // 打印结果
  System.out.println(myZhihu);
 }
}

Ok This is done. Run it and see the results:

Write Java Zhihu crawler with zero foundation to obtain content recommended by Zhihu editors (4)

Good results.

The next step is to access the link and get all the answers.

We will introduce it next time.

Okay, the above is a brief introduction to the entire process of how to use java to capture content recommended by Zhihu editors. It is very detailed and easy to understand. Friends who need it can refer to it. , there is no problem in free expansion



The above is the content of writing Java Zhihu crawler with zero foundation to obtain Zhihu editor recommended content (4). For more related content, please pay attention to the PHP Chinese website (www.php.cn )!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn