项目初始化

This commit is contained in:
lqyan 2024-10-13 15:33:34 +08:00
parent 35ef90a52c
commit 9b6cb6fc14
9 changed files with 170 additions and 0 deletions

2
.gitignore vendored
View File

@ -24,3 +24,5 @@
hs_err_pid*
replay_pid*
.idea
target

0
db/a.html Normal file
View File

16
db/init-database.sql Normal file
View File

@ -0,0 +1,16 @@
create table madou_video_info
(
id bigserial primary key not null,
title varchar(255) not null,
classify varchar(255) not null,
cover_url varchar(255),
m3u8_url varchar(255)
);
create table classify_info
(
id bigserial primary key not null,
name varchar(255) not null,
url varchar(255) not null,
page_size int not null
);
select sum(page_size) * 18 / 1024 / 2 from classify_info;

54
pom.xml Normal file
View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" ?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>crawler-video</artifactId>
<groupId>top.yuchat</groupId>
<version>0.0.1</version>
<name>crawler-video</name>
<packaging>jar</packaging>
<description>某个网站的视频爬取</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-parent</artifactId>
<version>3.2.3</version>
</parent>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
<version>3.5.7</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,12 @@
package top.yuchat.crawler.video;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class CrawlerVideoApplication {
public static void main(String[] args) {
SpringApplication.run(CrawlerVideoApplication.class, args);
}
}

View File

@ -0,0 +1,37 @@
package top.yuchat.crawler.video.config;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.apache.ibatis.reflection.MetaObject;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.time.LocalDateTime;
@Configuration
@MapperScan("top.yuchat.crawler.video.**.mapper")
public class MybatisConfig implements MetaObjectHandler {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor(){
MybatisPlusInterceptor mpi = new MybatisPlusInterceptor();
mpi.addInnerInterceptor(new PaginationInnerInterceptor());
mpi.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
return mpi;
}
@Override
public void insertFill(MetaObject metaObject) {
this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, LocalDateTime.now());
this.strictInsertFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now());
}
@Override
public void updateFill(MetaObject metaObject) {
this.strictUpdateFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now());
}
}

View File

@ -0,0 +1,21 @@
package top.yuchat.crawler.video.models.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
@Data
public class MadouVideoInfo {
@TableId(type = IdType.AUTO)
private Long id;
private String title;
private String classify;
private String coverUrl;
private String m3u8Url;
}

View File

@ -0,0 +1,7 @@
package top.yuchat.crawler.video.models.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import top.yuchat.crawler.video.models.entity.MadouVideoInfo;
public interface MadouVideoMapper extends BaseMapper<MadouVideoInfo> {
}

View File

@ -0,0 +1,21 @@
package top.yuchat.crawler.video.models.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import top.yuchat.crawler.video.models.entity.MadouVideoInfo;
import top.yuchat.crawler.video.models.mapper.MadouVideoMapper;
@Service
public class MadouVideoService extends ServiceImpl<MadouVideoMapper, MadouVideoInfo> {
/**
* /index.php/vod/type/id/3.html
* 1-10
* 20-27
* 29-30
*
* /index.php/vod/type/id/1/page/2.html
*
* https://yutujx.com/?url=https://t20a.cdn2020.com/video/m3u8/2022/10/23/cc234c9c/index.m3u8
*/
}