From 1486719c2dd08ee9929a46c3da4693eedbc6b08b Mon Sep 17 00:00:00 2001 From: "guorong.zheng" <360996299@qq.com> Date: Tue, 6 Feb 2024 16:24:26 +0800 Subject: [PATCH] chore --- main.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/main.py b/main.py index 490af80c1f..3329b12c14 100644 --- a/main.py +++ b/main.py @@ -2,7 +2,6 @@ from selenium import webdriver import time from selenium.webdriver.common.by import By -import os import re import requests from selenium_stealth import stealth @@ -60,7 +59,7 @@ def getChannelItems(self): def outputTxt(self,cate,channelUrls): # 创建一个新的final文件 - with open('result.txt', 'r') as f: + with open(self.finalFile, 'w', encoding='utf-16') as f: for name, urls in channelUrls.items(): f.write(cate + ',#genre#\n') for url in urls: @@ -90,13 +89,8 @@ def compareSpeed(self,pageUrls): return pageUrls_new - def removeFile(self): - if os.path.exists(self.finalFile): - os.remove(self.finalFile) - def visitPage(self,channelItems): self.driver.get("https://www.foodieguide.com/iptvsearch/") - self.removeFile() for cate, names in channelItems.items(): channelUrls = {} for name in names: