You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

基于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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.04 22:45:35