Created
January 7, 2019 08:05
-
-
Save gjp0609/3fc8bbec4bca62ab05dd4ab92678a307 to your computer and use it in GitHub Desktop.
Jsoup parse html in sinngle line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.metacritic.com/browse/games/release-date/available/ps4/metascore | |
Jsoup.parse(new BufferedReader(new FileReader(new File("C:/Files/ps4.html"))) | |
.lines() | |
.reduce(Jsoup.parse(new BufferedReader(new FileReader(new File("C:/Files/ByUser.html"))) | |
.lines() | |
.reduce("", (acc, item) -> acc + item)).toString(), (acc, item) -> acc + item)) | |
.select(".product_wrap") | |
.stream() | |
.sorted(Comparator.comparing(e -> ((Element) e).select(".textscore").text()).reversed()) | |
.map(item -> "\033[106m " | |
.concat(item.select(".textscore").text()) | |
.concat(" \033[102m ") | |
.concat(String.format("%3s", item.select(".metascore_w").text())) | |
.concat(" \033[91m ") | |
.concat(item.select("a").text())) | |
.distinct() | |
.forEach(System.out::println); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment