diff --git a/README.md b/README.md index ddb9186..c1664bd 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,10 @@ B站的热门榜数据具有极高的研究价值和应用前景。视频的播 开发一个针对B站的爬虫项目,实现对B站数据的自动化抓取和分析,对于学术研究、商业分析还是个人兴趣探索都具有重要意义。 - - -![](assets/2024-04-26-10-47-09-image.png) +
良好的git分支管理
![](assets/2024-04-26-10-50-50-image.png)
项目结构展示
- - diff --git a/service/CsvService.py b/service/CsvService.py index da73323..537889f 100644 --- a/service/CsvService.py +++ b/service/CsvService.py @@ -1,10 +1,12 @@ +from typing import List + from service.IFileService import IFileService from entity.BilibiliVideo import BilibiliVideo from controller.SpyderController import SpyderController import csv class CsvService(IFileService): - def save(self, filePath, videoList: list[BilibiliVideo]): + def save(self, filePath, videoList: List[BilibiliVideo]): f = open(filePath+".csv", "w", encoding="GB18030", newline="") csv_writer = csv.writer(f) csv_writer.writerow( diff --git a/service/ExcelService.py b/service/ExcelService.py index 1f0b2c6..78a6f91 100644 --- a/service/ExcelService.py +++ b/service/ExcelService.py @@ -1,3 +1,5 @@ +from typing import List + from service.IFileService import IFileService from entity.BilibiliVideo import BilibiliVideo @@ -9,5 +11,5 @@ class ExcelService(IFileService): """ pass - def save(self, filePath, videoList: list[BilibiliVideo]): + def save(self, filePath, videoList: List[BilibiliVideo]): raise NotImplementedError diff --git a/service/IFileService.py b/service/IFileService.py index ab4c576..fb4f25b 100644 --- a/service/IFileService.py +++ b/service/IFileService.py @@ -1,11 +1,12 @@ from abc import abstractmethod, ABCMeta +from typing import List from entity.BilibiliVideo import BilibiliVideo class IFileService(metaclass=ABCMeta): @abstractmethod - def save(self,filePath,videoList:list[BilibiliVideo]): + def save(self,filePath,videoList:List[BilibiliVideo]): """ 保存到文件,高级参数在init里面写 :param filePath: 文件保存路径