惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
S
Securelist
D
Docker
The Register - Security
The Register - Security
GbyAI
GbyAI
Recorded Future
Recorded Future
Engineering at Meta
Engineering at Meta
Stack Overflow Blog
Stack Overflow Blog
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
罗磊的独立博客
博客园 - 【当耐特】
F
Full Disclosure
WordPress大学
WordPress大学
腾讯CDC
小众软件
小众软件
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
SecWiki News
SecWiki News
L
Lohrmann on Cybersecurity
I
InfoQ
MyScale Blog
MyScale Blog
量子位
Cyberwarzone
Cyberwarzone
博客园 - 三生石上(FineUI控件)
The Hacker News
The Hacker News
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Jina AI
Jina AI
博客园_首页
H
Help Net Security
K
Kaspersky official blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Webroot Blog
Webroot Blog
Blog — PlanetScale
Blog — PlanetScale
V
Vulnerabilities – Threatpost
Y
Y Combinator Blog
The Cloudflare Blog
P
Proofpoint News Feed
V
Visual Studio Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tailwind CSS Blog
爱范儿
爱范儿
P
Privacy International News Feed
Security Archives - TechRepublic
Security Archives - TechRepublic
The GitHub Blog
The GitHub Blog
C
Cybersecurity and Infrastructure Security Agency CISA
B
Blog RSS Feed

博客园 - 你看起来真的很好吃

linux系统时间管理 安装历史docker版本 OCR文本提取+NER命名实体识别 测试 深度学习-激活函数 go——make和new的区别 go——GC垃圾回收机制 go——标识符的命名规范 go语言——数据类型 go语言——转义符 go开发环境安装 git使用 项目文档目录总结 鼠标连点器——python版 windows使用YOLOV5训练模型——搭建编译环境 高匿名动态IP代理获取 logging模块进行格式化输出 Django admin 添加操作记录 facenet + fiass 实现人脸识别
笔记
你看起来真的很好吃 · 2023-09-23 · via 博客园 - 你看起来真的很好吃
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

class Tiktok:
def __init__(self):
# 创建浏览器实例
self.browser = webdriver.Chrome()
self.user_info = []

def get_fllow_info(self):
"""获取已关注主播信息"""
fllow_div = self.browser.find_element(By.XPATH, "//div[@id='main-content-homepage_follow']")
card_divs = fllow_div.find_elements(By.XPATH, "//div[@data-e2e='recommend-card']")

for index, item in enumerate(card_divs):
# 获取主播主页地址、姓名
index_url = item.find_element(By.XPATH, "a").get_attribute("href")
user_name = item.find_elements(By.XPATH, "//h3")[index].text
self.user_info.append({"name": user_name, "index_url": index_url})

def run(self):
# 打开网页
self.browser.get('https://www.tiktok.com/')

# 进入我的关注页面
element = WebDriverWait(self.browser, 120, 1).until(
EC.presence_of_element_located((By.XPATH, "//a[@data-e2e='nav-following']"))
)
element.click()

# 获取关注的主播信息
self.get_fllow_info()

# 查找搜索按钮并单击
search_button = browser.find_element_by_id('su')
search_button.click()

# 关闭浏览器
browser.quit()

if __name__ == "__main__":
tiktok = Tiktok()
tiktok.run()