调整金额
This commit is contained in:
@@ -123,7 +123,7 @@ public class LotteryWebMagicCrawler implements PageProcessor {
|
|||||||
* @param htmlContent 爬取到的HTML文本内容
|
* @param htmlContent 爬取到的HTML文本内容
|
||||||
* @return 解析后的结构化数据列表
|
* @return 解析后的结构化数据列表
|
||||||
*/
|
*/
|
||||||
public static List<Map<String, Object>> parseLotteryHtml(String htmlContent) {
|
public List<Map<String, Object>> parseLotteryHtml(String htmlContent) {
|
||||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||||
|
|
||||||
// 初始化Jsoup解析器
|
// 初始化Jsoup解析器
|
||||||
@@ -242,7 +242,7 @@ public class LotteryWebMagicCrawler implements PageProcessor {
|
|||||||
return resultList;
|
return resultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void writeToJsonFile(List<Map<String, Object>> resultList) {
|
public void writeToJsonFile(List<Map<String, Object>> resultList) {
|
||||||
try {
|
try {
|
||||||
// 创建 ObjectMapper 实例
|
// 创建 ObjectMapper 实例
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
@@ -251,7 +251,7 @@ public class LotteryWebMagicCrawler implements PageProcessor {
|
|||||||
objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
|
objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
|
||||||
|
|
||||||
// 定义输出目录
|
// 定义输出目录
|
||||||
String directoryPath = "PyModel/current_data"; // 项目根目录下的 output/json 文件夹
|
String directoryPath = path+"/current_data"; // 项目根目录下的 output/json 文件夹
|
||||||
|
|
||||||
// 使用年月日作为文件名(格式:result_yyyyMMdd.json)
|
// 使用年月日作为文件名(格式:result_yyyyMMdd.json)
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
|||||||
Reference in New Issue
Block a user