diff --git a/controller/UIController.py b/controller/UIController.py index e94d3cb..dd7e284 100644 --- a/controller/UIController.py +++ b/controller/UIController.py @@ -35,14 +35,30 @@ class UIController: # 这里可以添加按钮点击事件的逻辑 print("start_Button clicked!") videoCount=entry1.get() - threadCount=entry2.get() - waitTime=entry3.get() + threadCount = entry2.get() + waitTime = entry3.get() + if(videoCount==''): + videoCount=999 + threadCount=10 + waitTime=0.3 + else: + if videoCount.isdigit(): + videoCount=eval(videoCount) + else: + return print("video count is not digit") + if threadCount.isdigit(): + threadCount=eval(threadCount) + else: + return print("thread count is not num ") + if waitTime.isdigit(): + waitTime=eval(waitTime) + else: + return print("waitTime is not num") #创建 SpyderController对象调用其函数 SpyderController=SC.SpyderController() - # global scRuslt_data + self.scRuslt_data=SpyderController.getBilibiliVideoList(videoCount,threadCount,waitTime) print("爬取完成") - # print(scRuslt_data) @@ -61,6 +77,8 @@ class UIController: theList.append(data.bvId) theList.append(data.title) theList.append(data.url) + theList.append(data.uploadTime) + theList.append(data.uploadTimeText) theList.append(data.topNo) theList.append(data.viewCount) theList.append(data.likeCount) @@ -116,21 +134,22 @@ class UIController: button_save_to_csv = tk.Button(root, text="save to csv", command=button_save_to_csv_click) button_save_to_csv.grid(row=6, column=1,sticky=tk.W) # 创建一个带展示框 - tree = ttk.Treeview(root, columns=("bvid", "title","url","upload","topNo","viewCount","likeCount","coinCount","favorite","commentCount","bolletCount","creatorld","creatorName","createFanCount")) + tree = ttk.Treeview(root, columns=("bvid", "title","url",'uploadTime',"uploadTimeText","topNo","viewCount","likeCount","coinCount","favorite","commentCount","bolletCount","creatorld","creatorName","createFanCount")) tree.heading("#1", text="bvid") tree.heading("#2", text="title") tree.heading('#3', text="url") - tree.heading('#4', text="upload") - tree.heading('#5', text="topNo") - tree.heading('#6', text="ViewCount") - tree.heading('#7', text="likeCount") - tree.heading('#8', text="coinCount") - tree.heading('#9', text="favorite") - tree.heading('#10', text="commentCount") - tree.heading('#11', text="bulletCount") - tree.heading('#12', text="creadtorId") - tree.heading('#13', text="creatorName") - tree.heading('#14', text="createFanCount") + tree.heading('#4', text="uploadtime") + tree.heading('#5', text="uploadtimeTexT") + tree.heading('#6', text="topNo") + tree.heading('#7', text="ViewCount") + tree.heading('#8', text="likeCount") + tree.heading('#9', text="coinCount") + tree.heading('#10', text="favorite") + tree.heading('#11', text="commentCount") + tree.heading('#12', text="bulletCount") + tree.heading('#13', text="creadtorId") + tree.heading('#14', text="creatorName") + tree.heading('#15', text="createFanCount") # 向展示框添加数据