【问题标题】:Get current URL using Python and webbot使用 Python 和 webbot 获取当前 URL
【发布时间】:2019-06-17 04:50:09
【问题描述】:

有没有办法使用 webbot 获取当前 url? 我查看了使用os.environ 的方法,但它对我不起作用。 我需要使用webbot.Browser() 打开的页面的网址,因为某些链接会被重定向和更改。

【问题讨论】:

  • 虽然项目页面和文档的拼写错误比我的阅读障碍表弟的英语作业要多,但我希望您正在寻找这个:get_current_url() 这里webbot.readthedocs.io/en/latest/webbot.html - 来自示例和文档的质量,不过我会小心测试。
  • Mental Note To Self:在转向 stackoverflow 之前阅读官方文档。附:代我向你表弟问好:)
  • 可能是个好建议,请注意自己 - 所以可能会变得刻薄;-)

标签: python url web-scraping webbot


【解决方案1】:

您可以使用 get_current_url()。 考虑以下示例:

from webbot import Browser
web = Browser()
url = 'something.com' # site name
web.go_to(url)
... #your code
webbot_result_url = web.get_current_url()
print(webbot_result_url )

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-08-09
    • 1970-01-01
    • 2010-11-05
    • 2010-09-29
    相关资源
    最近更新 更多