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.

21 lines
596 B

import java.util.List;
public class Main {
public static void main(String[] args) {
// 1. 创建上下文
CrawlerContext context = new CrawlerContext();
// 2. 动态添加策略(想爬哪个就加哪个,随时增删)
context.addStrategy(new DoubanStrategy());
context.addStrategy(new XiaohongshuStrategy());
context.addStrategy(new DouyinStrategy());
// 3. 执行爬取
List<Movie> movies = context.executeAllCrawl(2);
// 4. 多态播放
for (Movie m : movies) {
m.play();
}
}
}