8000 GitHub - amaoamao/cninfo-java: 一个使用okhttp,gson的巨潮信息网爬虫
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

一个使用okhttp,gson的巨潮信息网爬虫

Notifications You must be signed in to change notification settings

amaoamao/cninfo-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cninfo-java

一个巨潮信息网爬虫,直接clone本项目写个main方法运行即可。

public class Application {
    public static void main(String[] args) throws CIClient.HistoryTooLargeException, IOException {
        CIClient ci = new CIClient();
        Calendar calendar1 = Calendar.getInstance();
        calendar1.set(2017, 1, 21);
        Calendar calendar2 = Calendar.getInstance();
        calendar2.set(2017, 1, 22);
        boolean hasMore;
        int pageNum = 0;
        do {
            QueryResult result = ci.queryHistory(Plate.values(), new Category[]{Category.jy}, calendar1, calendar2, ++pageNum);
            hasMore = result.getHasMore();
            List<Announcement> announcements = result.getAnnouncements();
            announcements.forEach(announcement -> {
                ci.downloadPDF("./downloads/" + announcement.getSecName() + "/", announcement.getAnnouncementTitle(),
                 announcement,
                 new PDFDownloadCallback() {
                    @Override
                    public void onSucceed() {
                        System.out.println("Succeed " + announcement.getAnnouncementTitle());
                    }

                    @Override
                    public void onFailure(Request request, IOException e) {
                        System.err.println("Failed " + announcement.getAnnouncementTitle());
                    }
                });
            });
        } while (hasMore);
    }
}

依赖

  • OkHttp 2.7.5
  • gson 2.8.0
  • jdk1.8

About

一个使用okhttp,gson的巨潮信息网爬虫

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0