diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml
new file mode 100644
index 0000000..ac8ae2c
--- /dev/null
+++ b/.idea/checkstyle-idea.xml
@@ -0,0 +1,16 @@
+
+
+
+ 10.7.0
+ JavaOnly
+ true
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 6a479b1..afeaa8b 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -2,6 +2,7 @@
+
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
index fc2343b..5108ac5 100644
--- a/.idea/encodings.xml
+++ b/.idea/encodings.xml
@@ -1,6 +1,6 @@
-
+
@@ -17,5 +17,6 @@
+
\ No newline at end of file
diff --git a/.idea/intellij-javadocs-4.0.1.xml b/.idea/intellij-javadocs-4.0.1.xml
new file mode 100644
index 0000000..5d2c532
--- /dev/null
+++ b/.idea/intellij-javadocs-4.0.1.xml
@@ -0,0 +1,204 @@
+
+
+
+
+ UPDATE
+ false
+ true
+
+ METHOD
+ FIELD
+ TYPE
+
+
+ DEFAULT
+ PUBLIC
+ PROTECTED
+
+
+
+
+
+ ^.*(public|protected|private)*.+interface\s+\w+.*
+ /**\n
+ * The interface ${name}.\n
+<#if element.typeParameters?has_content> * \n
+</#if>
+<#list element.typeParameters as typeParameter>
+ * @param <${typeParameter.name}> the type parameter\n
+</#list>
+ */
+
+
+ ^.*(public|protected|private)*.+enum\s+\w+.*
+ /**\n
+ * The enum ${name}.\n
+ */
+
+
+ ^.*(public|protected|private)*.+class\s+\w+.*
+ /**\n
+ * The type ${name}.\n
+<#if element.typeParameters?has_content> * \n
+</#if>
+<#list element.typeParameters as typeParameter>
+ * @param <${typeParameter.name}> the type parameter\n
+</#list>
+ */
+
+
+ .+
+ /**\n
+ * The type ${name}.\n
+ */
+
+
+
+
+ .+
+ /**\n
+ * Instantiates a new ${name}.\n
+<#if element.parameterList.parameters?has_content>
+ *\n
+</#if>
+<#list element.parameterList.parameters as parameter>
+ * @param ${parameter.name} the ${paramNames[parameter.name]}\n
+</#list>
+<#if element.throwsList.referenceElements?has_content>
+ *\n
+</#if>
+<#list element.throwsList.referenceElements as exception>
+ * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
+</#list>
+ */
+
+
+
+
+ ^.*(public|protected|private)*\s*.*(\w(\s*<.+>)*)+\s+get\w+\s*\(.*\).+
+ /**\n
+ * Gets ${partName}.\n
+<#if element.typeParameters?has_content> * \n
+</#if>
+<#list element.typeParameters as typeParameter>
+ * @param <${typeParameter.name}> the type parameter\n
+</#list>
+<#if element.parameterList.parameters?has_content>
+ *\n
+</#if>
+<#list element.parameterList.parameters as parameter>
+ * @param ${parameter.name} the ${paramNames[parameter.name]}\n
+</#list>
+<#if isNotVoid>
+ *\n
+ * @return the ${partName}\n
+</#if>
+<#if element.throwsList.referenceElements?has_content>
+ *\n
+</#if>
+<#list element.throwsList.referenceElements as exception>
+ * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
+</#list>
+ */
+
+
+ ^.*(public|protected|private)*\s*.*(void|\w(\s*<.+>)*)+\s+set\w+\s*\(.*\).+
+ /**\n
+ * Sets ${partName}.\n
+<#if element.typeParameters?has_content> * \n
+</#if>
+<#list element.typeParameters as typeParameter>
+ * @param <${typeParameter.name}> the type parameter\n
+</#list>
+<#if element.parameterList.parameters?has_content>
+ *\n
+</#if>
+<#list element.parameterList.parameters as parameter>
+ * @param ${parameter.name} the ${paramNames[parameter.name]}\n
+</#list>
+<#if isNotVoid>
+ *\n
+ * @return the ${partName}\n
+</#if>
+<#if element.throwsList.referenceElements?has_content>
+ *\n
+</#if>
+<#list element.throwsList.referenceElements as exception>
+ * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
+</#list>
+ */
+
+
+ ^.*((public\s+static)|(static\s+public))\s+void\s+main\s*\(\s*String\s*(\[\s*\]|\.\.\.)\s+\w+\s*\).+
+ /**\n
+ * The entry point of application.\n
+
+ <#if element.parameterList.parameters?has_content>
+ *\n
+</#if>
+ * @param ${element.parameterList.parameters[0].name} the input arguments\n
+<#if element.throwsList.referenceElements?has_content>
+ *\n
+</#if>
+<#list element.throwsList.referenceElements as exception>
+ * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
+</#list>
+ */
+
+
+ .+
+ /**\n
+ * ${name}<#if isNotVoid> ${return}</#if>.\n
+<#if element.typeParameters?has_content> * \n
+</#if>
+<#list element.typeParameters as typeParameter>
+ * @param <${typeParameter.name}> the type parameter\n
+</#list>
+<#if element.parameterList.parameters?has_content>
+ *\n
+</#if>
+<#list element.parameterList.parameters as parameter>
+ * @param ${parameter.name} the ${paramNames[parameter.name]}\n
+</#list>
+<#if isNotVoid>
+ *\n
+ * @return the ${return}\n
+</#if>
+<#if element.throwsList.referenceElements?has_content>
+ *\n
+</#if>
+<#list element.throwsList.referenceElements as exception>
+ * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
+</#list>
+ */
+
+
+
+
+ ^.*(public|protected|private)*.+static.*(\w\s\w)+.+
+ /**\n
+ * The constant ${element.getName()}.\n
+ */
+
+
+ ^.*(public|protected|private)*.*(\w\s\w)+.+
+ /**\n
+ <#if element.parent.isInterface()>
+ * The constant ${element.getName()}.\n
+<#else>
+ * The ${name}.\n
+</#if> */
+
+
+ .+
+ /**\n
+ <#if element.parent.isEnum()>
+ *${name} ${typeName}.\n
+<#else>
+ * The ${name}.\n
+</#if>*/
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index 712ab9d..38fd58e 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -6,6 +6,11 @@
+
+
+
+
+
@@ -16,5 +21,10 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/json_jena_1_0.xml b/.idea/libraries/json_jena_1_0.xml
new file mode 100644
index 0000000..eedb938
--- /dev/null
+++ b/.idea/libraries/json_jena_1_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index e3d31c2..89d68e4 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -17,4 +17,7 @@
+
+
+
\ No newline at end of file
diff --git a/AccountModule/AccountModule.iml b/AccountModule/AccountModule.iml
new file mode 100644
index 0000000..9e3449c
--- /dev/null
+++ b/AccountModule/AccountModule.iml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BarrageModule/BarrageModule.iml b/BarrageModule/BarrageModule.iml
new file mode 100644
index 0000000..9e3449c
--- /dev/null
+++ b/BarrageModule/BarrageModule.iml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BarrageModule/lib/Msc.jar b/BarrageModule/lib/Msc.jar
new file mode 100644
index 0000000..5dc23e9
Binary files /dev/null and b/BarrageModule/lib/Msc.jar differ
diff --git a/BarrageModule/lib/json-jena-1.0.jar b/BarrageModule/lib/json-jena-1.0.jar
new file mode 100644
index 0000000..92b6be2
Binary files /dev/null and b/BarrageModule/lib/json-jena-1.0.jar differ
diff --git a/BarrageModule/pom.xml b/BarrageModule/pom.xml
index 65db00d..8800606 100644
--- a/BarrageModule/pom.xml
+++ b/BarrageModule/pom.xml
@@ -18,11 +18,26 @@
+
+ com.alibaba.fastjson2
+ fastjson2
+ 2.0.26
+
junit
junit
- 3.8.1
+ 4.12
test
+
+ org.springframework.boot
+ spring-boot-starter-test
+
+
+ org.example
+ FileModule
+ 1.0-SNAPSHOT
+ compile
+
diff --git a/BarrageModule/src/main/java/org/example/App.java b/BarrageModule/src/main/java/org/example/App.java
index 5f21d2e..38c5eef 100644
--- a/BarrageModule/src/main/java/org/example/App.java
+++ b/BarrageModule/src/main/java/org/example/App.java
@@ -2,12 +2,9 @@ package org.example;
/**
* Hello world!
- *
*/
-public class App
-{
- public static void main( String[] args )
- {
- System.out.println( "Hello World!" );
+public class App {
+ public static void main(String[] args) {
+ System.out.println("Hello World!");
}
}
diff --git a/BarrageModule/src/main/java/org/example/BarrageFile/GetFile.java b/BarrageModule/src/main/java/org/example/BarrageFile/GetFile.java
new file mode 100644
index 0000000..139fdec
--- /dev/null
+++ b/BarrageModule/src/main/java/org/example/BarrageFile/GetFile.java
@@ -0,0 +1,59 @@
+package org.example.BarrageFile;
+/**
+ * @description : [用于提取config模块的弹幕文件]
+ * @author : [Welsir]
+ * @createTime : [2023/5/15 22:12]
+ */
+
+import com.alibaba.fastjson.JSONArray;
+import org.example.entity.Barrage;
+import org.example.util.JsonFileUtil;
+import org.junit.jupiter.api.Test;
+
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * @author welsir
+ * @date 2023/5/15 22:12
+ */
+public class GetFile {
+
+ private static final String barrageFile = "../config/barrage/";
+
+ private static ConcurrentHashMap> anchorMap = new ConcurrentHashMap<>();
+
+ @Test
+ public void getBarrageFile(){
+ File rootFile = new File(barrageFile);
+ if(rootFile.exists()&&rootFile.isDirectory()){
+ classifyAndProcessFolders(rootFile);
+ }
+ System.out.println(anchorMap.size());
+ }
+ private static void classifyAndProcessFolders(File folder) {
+ File[] subFolders = folder.listFiles(File::isDirectory);
+ if (subFolders != null) {
+ for (File subFolder : subFolders) {
+ String folderName = subFolder.getName();
+
+ File[] jsonFiles = subFolder.listFiles((dir, name) -> name.toLowerCase().endsWith(".json"));
+
+ if (jsonFiles != null) {
+ for (File jsonFile : jsonFiles) {
+ // 处理JSON文件,例如读取内容或进行其他操作
+ Map readJsonFile = JsonFileUtil.readJsonFile(jsonFile.getPath());
+ JSONArray data = (JSONArray) readJsonFile.get("data");
+ List barrageList = Barrage.copyProperty(data);
+ anchorMap.put(folderName,barrageList);
+ }
+ }
+// anchorMap.put(folderName,barrages);
+ // 递归遍历子文件夹
+ classifyAndProcessFolders(subFolder);
+ }
+ }
+ }
+}
diff --git a/BarrageModule/src/main/java/org/example/config/BarrageScoreConfig.java b/BarrageModule/src/main/java/org/example/config/BarrageScoreConfig.java
new file mode 100644
index 0000000..49cb52f
--- /dev/null
+++ b/BarrageModule/src/main/java/org/example/config/BarrageScoreConfig.java
@@ -0,0 +1,86 @@
+package org.example.config;
+/**
+ * @description : [自定义弹幕评分配置]
+ * @author : [Welsir]
+ * @createTime : [2023/5/15 22:14]
+ */
+
+import com.alibaba.fastjson.JSON;
+import org.example.entity.Anchor;
+import org.example.util.JsonFileUtil;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * @author welsir
+ * @date 2023/5/15 22:14
+ */
+public class BarrageScoreConfig {
+
+ private static List anchorList = new ArrayList<>();
+ private static HashMap anchorMap = new HashMap<>();
+
+ /**
+ * @description: 解析配置文件,获取主播自定义关键词得分配置
+ */
+ public static void getConfigFile() throws Exception {
+ String jsonStr = "";
+ try (InputStream inputStream = BarrageScoreConfig.class.getResourceAsStream("/anchor/score.json");
+ BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {
+ String line;
+ while ((line = reader.readLine()) != null) {
+ jsonStr += line;
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ anchorList = JSON.parseArray(jsonStr, Anchor.class);
+ for (Anchor anchor : anchorList) {
+ anchorMap.put(anchor.getName(),anchorList.indexOf(anchor));
+ }
+ System.out.println(anchorList);
+ }
+
+ /**
+ * @description: 设置主播关键词并写入文件
+ */
+ public static void setAnchorConfig(List list){
+ for (Anchor anchor : list) {
+ int idx = anchorMap.get(anchor.getName())==null?0:anchorMap.get(anchor.getName());
+ if(idx!=0){
+ List property = anchorList.get(idx).getProperty();
+ property.addAll(anchor.getProperty());
+ }else {
+ anchorList.add(anchor);
+ }
+ }
+ JsonFileUtil.writeJsonFile("D:\\idea_Project\\Springboot\\ChopperBot\\BarrageModule\\src\\main\\resources\\anchor\\","score.json",anchorList);
+ }
+
+ public static void main(String[] args) throws Exception {
+ getConfigFile();
+
+ ArrayList list = new ArrayList<>();
+ Anchor anchor = new Anchor();
+ anchor.setName("水晶哥");
+ ArrayList properties = new ArrayList<>();
+ properties.add(new Anchor.property("666",5));
+ properties.add(new Anchor.property("下播",7));
+ anchor.setProperty(properties);
+ Anchor anchor1 = new Anchor();
+ anchor1.setName("小团团");
+ ArrayList properties1 = new ArrayList<>();
+ properties1.add(new Anchor.property("666",5));
+ properties1.add(new Anchor.property("下播",7));
+ anchor1.setProperty(properties1);
+ list.add(anchor);
+ list.add(anchor1);
+ setAnchorConfig(list);
+ }
+}
diff --git a/BarrageModule/src/main/java/org/example/entity/Anchor.java b/BarrageModule/src/main/java/org/example/entity/Anchor.java
new file mode 100644
index 0000000..194b249
--- /dev/null
+++ b/BarrageModule/src/main/java/org/example/entity/Anchor.java
@@ -0,0 +1,70 @@
+package org.example.entity;
+/**
+ * @description : [配置文件实体类]
+ * @author : [Welsir]
+ * @createTime : [2023/5/15 22:51]
+ */
+
+import java.util.List;
+
+/**
+ * @author welsir
+ * @date 2023/5/15 22:51
+ */
+public class Anchor {
+ private String name;
+
+ public List getProperty() {
+ return property;
+ }
+
+ public void setProperty(List property) {
+ this.property = property;
+ }
+
+ private List property;
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public static class property{
+ int weight;
+
+ String content;
+
+ public int getWeight() {
+ return weight;
+ }
+
+ public void setWeight(int weight) {
+ this.weight = weight;
+ }
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ @Override
+ public String toString() {
+ return "{weight:"+getWeight()+",content:"+getContent()+"}";
+ }
+
+ public property(String content,int weight){
+ this.content = content;
+ this.weight = weight;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "{name:"+getName()+",property:"+getProperty()+"}";
+ }
+}
diff --git a/CreeperModule/src/main/java/org/example/pojo/Barrage.java b/BarrageModule/src/main/java/org/example/entity/Barrage.java
similarity index 55%
rename from CreeperModule/src/main/java/org/example/pojo/Barrage.java
rename to BarrageModule/src/main/java/org/example/entity/Barrage.java
index 85894bf..355c783 100644
--- a/CreeperModule/src/main/java/org/example/pojo/Barrage.java
+++ b/BarrageModule/src/main/java/org/example/entity/Barrage.java
@@ -1,6 +1,12 @@
-package org.example.pojo;
+package org.example.entity;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
import lombok.Data;
+import netscape.javascript.JSObject;
+
+import java.util.ArrayList;
+import java.util.List;
/**
* 弹幕通用类
@@ -22,10 +28,21 @@ public class Barrage {
// 弹幕内容
private String content;
+ public Barrage(){
+
+ }
+
public Barrage(String mid, Long timeReal, Long timeIndex, String content) {
this.mid = mid;
this.timeReal = timeReal;
this.timeIndex = timeIndex;
this.content = content;
}
+
+ /**
+ * @description: use to set BarrageProperty
+ */
+ public static List copyProperty(JSONArray BarrageList){
+ return JSON.parseArray(BarrageList.toJSONString(), Barrage.class);
+ }
}
diff --git a/BarrageModule/src/main/resources/anchor/score.json b/BarrageModule/src/main/resources/anchor/score.json
new file mode 100644
index 0000000..1434e72
--- /dev/null
+++ b/BarrageModule/src/main/resources/anchor/score.json
@@ -0,0 +1,57 @@
+[
+ {
+ "name":"大司马",
+ "property":[
+ {
+ "content":"哈哈哈",
+ "weight":10
+ },
+ {
+ "content":"素材局",
+ "weight":10
+ }
+ ]
+ },
+ {
+ "name":"水晶哥",
+ "property":[
+ {
+ "content":"陌生",
+ "weight":10
+ },
+ {
+ "content":"没道理",
+ "weight":10
+ },
+ {
+ "content":"666",
+ "weight":5
+ },
+ {
+ "content":"下播",
+ "weight":7
+ },
+ {
+ "content":"666",
+ "weight":5
+ },
+ {
+ "content":"下播",
+ "weight":7
+ }
+ ]
+ },
+ {
+ "name":"小团团",
+ "property":[
+ {
+ "content":"666",
+ "weight":5
+ },
+ {
+ "content":"下播",
+ "weight":7
+ }
+ ]
+ }
+]
\ No newline at end of file
diff --git a/CreeperModule/src/main/java/org/example/core/processor/Process_R_Douyu.java b/CreeperModule/src/main/java/org/example/core/processor/Process_R_Douyu.java
index 1230efc..63eda95 100644
--- a/CreeperModule/src/main/java/org/example/core/processor/Process_R_Douyu.java
+++ b/CreeperModule/src/main/java/org/example/core/processor/Process_R_Douyu.java
@@ -8,7 +8,7 @@ import org.example.pojo.download.assign.LoadConfig_R_Douyu;
import us.codecraft.webmagic.Page;
import us.codecraft.webmagic.Request;
import us.codecraft.webmagic.utils.HttpConstant;
-import java.net.http.HttpClient;
+
import java.util.ArrayList;
import java.util.List;
@@ -36,8 +36,11 @@ public class Process_R_Douyu extends AbstractProcessor {
if (isFirst) {
init(page);
isFirst = false;
+ Request request = new Request();
+ request.putExtra("type", "singer");
return;
}
+
processOnePage(page);
}
diff --git a/FileModule/pom.xml b/FileModule/pom.xml
index 250b53f..725639a 100644
--- a/FileModule/pom.xml
+++ b/FileModule/pom.xml
@@ -1,48 +1,54 @@
-
- ChopperBot
- org.example
- 1.0-SNAPSHOT
-
- 4.0.0
+
+ ChopperBot
+ org.example
+ 1.0-SNAPSHOT
+
+ 4.0.0
- FileModule
- jar
+ FileModule
+ jar
- FileModule
- http://maven.apache.org
+ FileModule
+ http://maven.apache.org
-
- UTF-8
-
+
+ UTF-8
+
-
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.12.3
+
-
- com.aliyun.oss
- aliyun-sdk-oss
- 3.10.2
-
-
- org.example
- common
- 1.0-SNAPSHOT
-
-
-
- com.alibaba
- fastjson
- 1.2.75
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.projectlombok
- lombok
-
-
+
+ com.aliyun.oss
+ aliyun-sdk-oss
+ 3.10.2
+
+
+ org.example
+ common
+ 1.0-SNAPSHOT
+
+
+
+ com.alibaba
+ fastjson
+ 1.2.75
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.projectlombok
+ lombok
+
+
diff --git a/FileModule/src/main/java/org/example/cache/FileCache.java b/FileModule/src/main/java/org/example/cache/FileCache.java
index 5beef05..c98f00a 100644
--- a/FileModule/src/main/java/org/example/cache/FileCache.java
+++ b/FileModule/src/main/java/org/example/cache/FileCache.java
@@ -13,10 +13,7 @@ import org.slf4j.LoggerFactory;
import java.io.File;
import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
diff --git a/console/src/main/java/org/example/ConsoleApplication.java b/console/src/main/java/org/example/ConsoleApplication.java
index c1604c3..101c21b 100644
--- a/console/src/main/java/org/example/ConsoleApplication.java
+++ b/console/src/main/java/org/example/ConsoleApplication.java
@@ -21,14 +21,10 @@ import java.util.concurrent.ConcurrentLinkedQueue;
@SpringBootApplication
public class ConsoleApplication {
- public static void main(String[] args) throws FileCacheException {
-
- LoadConfig loadConfig = new LoadConfig("斗鱼","Post","大司马");
- BarrageSaveFile barrageSaveFile = new BarrageSaveFile(loadConfig,new ConcurrentLinkedQueue<>());
+ public static void main(String[] args) {
if (Init()) {
SpringApplication.run(ConsoleApplication.class, args);
}
-
}
public static boolean Init(){