Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

有关网页跳转的问题 #20

Open
lyxaaa-a opened this issue May 28, 2020 · 2 comments
Open

有关网页跳转的问题 #20

lyxaaa-a opened this issue May 28, 2020 · 2 comments

Comments

@lyxaaa-a
Copy link

您好!您的爬虫爬取的是微博的“实时”内容,我想爬取“热门”内容。
但是研究了一下感觉那一部分是前端有关的代码,没有看懂,不知道怎么跳转到“热门”进行爬取。
希望您不吝赐教。

@czy1999
Copy link
Owner

czy1999 commented May 28, 2020

shishi_element = driver.find_element_by_xpath("//*[@class='scroll-box nav_item']/ul/li/span[text()='帖子']")

通过xpath获取‘实时’元素,然后发送点击操作即可跳转,若想爬取热门,可以将该行代码中的字符串更换为‘热门’的xpath路径,具体可以学习一下xpath的语法。

@lyxaaa-a
Copy link
Author

lyxaaa-a commented May 29, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants