基于Selenium Python的Telegram有效频道检测误判问题排查
Telegram有效频道检测工具误判问题解决请求
我正在开发一款基于Selenium与ChromeDriver的Telegram有效频道检测工具,目前无法区分Telegram提示频道不存在的两种页面样式,导致不存在的频道被误判为有效频道。现附上问题示例链接、当前代码,请求解决该误判问题的方案:
示例链接
- 不存在的频道1:
https://t.me/minecraft - 存在的频道:
https://t.me/minecraftapkdownload - 不存在的频道2:
https://telegram.org/
当前代码
for ss in cli1: driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=chrome_options) driver.maximize_window() driver.implicitly_wait(10) driver.get(f"https://t.me/{ss}") try: if WebDriverWait(driver, 5).until(EC.presence_of_element_located((By.XPATH, '/html/body/div[2]/div[2]/div/div/div[1]/div[2]/a/div'))): print(f'URL https://t.me/{ss} is not available') Not_Exist.append(ss) elif WebDriverWait(driver, 5).until(EC.presence_of_element_located((By.XPATH, '/html/body/div[2]/div[2]/div/div[2]/a'))): print(f'URL https://t.me/{ss} is not available') Not_Exist.append(ss) except: print(f'URL https://t.me/{ss} is valid') exists.append(ss) driver.quit() sleep(5)
内容的提问来源于stack exchange,提问作者TheBotHunter
相关产品推荐
相关产品推荐

