47 lines
1.2 KiB
Java
47 lines
1.2 KiB
Java
import org.jsoup.Jsoup;
|
|
import org.jsoup.nodes.Document;
|
|
import org.jsoup.nodes.Element;
|
|
import org.jsoup.select.Elements;
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.util.*;
|
|
|
|
public class Parser {
|
|
static List<Movie> movies = new ArrayList<>();
|
|
|
|
public List<Movie> sortByTitle() {
|
|
List<Movie> sortedByTitle = new ArrayList<>(movies);
|
|
// Sort movies alphabetically by title
|
|
//TODO
|
|
return sortedByTitle;
|
|
}
|
|
|
|
public List<Movie> sortByRating() {
|
|
List<Movie> sortedByRating = new ArrayList<>(movies);
|
|
// Sort movies by rating (highest to lowest)
|
|
//TODO
|
|
return sortedByRating;
|
|
}
|
|
|
|
public List<Movie> sortByYear() {
|
|
List<Movie> sortedByYear = new ArrayList<>(movies);
|
|
// Sort movies by year (newest to oldest)
|
|
//TODO
|
|
return sortedByYear;
|
|
}
|
|
|
|
public void setUp() throws IOException {
|
|
// Parse the HTML file using Jsoup
|
|
//TODO
|
|
|
|
// Extract data from the HTML
|
|
//TODO
|
|
|
|
// Iterate through each movie div to extract movie data
|
|
//TODO
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
// You can test your code here before you run the unit tests
|
|
}
|
|
} |