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)

黄舟
Release: 2016-12-24 11:31:43
Original
1201 people have browsed it

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);
 }
}
Copy after login

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 )!


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template