MubiListsScraper.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:mubi-lists-scraper 作者:
public static void main(String ars[]) throws XMLStreamException,
        FactoryConfigurationError, IOException {
    for (int page = 1; page <= 10; page++) {
        System.out.println("Fetching page " + page);
        URL url = new URL(MUBI_LISTS_BASE_URL + "&page=" + page);
        List<MubiListRef> lists = MubiListsReader.getInstance()
                .readMubiLists(url);
        for (MubiListRef list : lists) {
            System.out.println("  Fetching list " + list.getTitle());
            List<MubiFilmRef> filmList = MubiListsReader.getInstance()
                    .readMubiFilmList(
                            new URL(MUBI_BASE_URL + list.getUrl()));
            list.addFilms(filmList);
        }

        File outfile = new File("output", "mubi-lists-page-" + String.format("%04d", page) + ".json");
        System.out.println("Writing "+ outfile.getName());
        mapper.writeValue(outfile,
                lists);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号