czy1999 / weibo-topic-spider

微博超级话题爬虫,微博词频统计+情感分析+简单分类,新增肺炎超话爬取数据
MIT License
269 stars 65 forks source link

有关网页跳转的问题 #20

Open lyxaaa-a opened 4 years ago

lyxaaa-a commented 4 years ago

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

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

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

lyxaaa-a commented 4 years ago

您好 我还是没有找到 可以给我发一个吗

---原始邮件--- 发件人: "czy1999"<notifications@github.com> 发送时间: 2020年5月29日(周五) 上午7:24 收件人: "czy1999/weibo-topic-spider"<weibo-topic-spider@noreply.github.com>; 抄送: "Author"<author@noreply.github.com>;"lyxaaa-a"<809854719@qq.com>; 主题: Re: [czy1999/weibo-topic-spider] 有关网页跳转的问题 (#20)

shishi_element = driver.find_element_by_xpath("//*[@class='scroll-box nav_item']/ul/li/span[text()='帖子']")
通过xpath获取‘实时’元素,然后发送点击操作即可跳转,若想爬取热门,可以将该行代码中的字符串更换为‘热门’的xpath路径,具体可以学习一下xpath的语法。

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.