You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

40 lines
1.6 KiB

package strategy;
import model.Paper;
import java.util.ArrayList;
import java.util.List;
public class NewsRankStrategy implements CrawlStrategy {
public List crawl() throws Exception {
List papers = new ArrayList();
String[][] news = {
{"Tech Frontier: AI Model Breaks Record", "4982567", "https://example.com/news/1"},
{"Economic Outlook: Q1 2026 Analysis", "3892456", "https://example.com/news/2"},
{"Sports: World Cup Qualifiers", "3567234", "https://example.com/news/3"},
{"Culture: Annual Film Festival Opens", "2987654", "https://example.com/news/4"},
{"Health: New Vaccine Developed", "2876543", "https://example.com/news/5"},
{"Environment: Carbon Neutral Progress", "2567890", "https://example.com/news/6"},
{"Education: Exam Policy Adjusted", "2345678", "https://example.com/news/7"},
{"Military: Defense Tech Breakthrough", "2109876", "https://example.com/news/8"},
{"Entertainment: Celebrity's New Work", "1987654", "https://example.com/news/9"},
{"Society: Infrastructure Accelerates", "1876543", "https://example.com/news/10"}
};
for (int i = 0; i < news.length; i++) {
Paper paper = new Paper("news");
paper.setData("Rank", String.valueOf(i + 1));
paper.setData("Title", news[i][0]);
paper.setData("HotIndex", news[i][1]);
paper.setData("Link", news[i][2]);
papers.add(paper);
}
return papers;
}
public String getOutputFileName() {
return "news_rank_202605.csv";
}
}