private Post parsePost(Element element) { Post post = new Post(); post.setId(Long.parseLong(element.dataset().get("story-id"))); post.setTitle(element.select(titleSelector).text()); post.setContent(element.select(contentSelector).text()); post.setDescription(element.select(descriptionSelector).text()); post.setUrls(findUrls(post)); return post; }
private List<String> findUrls(Post post) { List<String> urls = new ArrayList<>(); urls.addAll(findUrls(post.getTitle())); urls.addAll(findUrls(post.getDescription())); return urls; }