使用 Python 模拟浏览器资源扩展行为

发布于 2024-09-05 17:06:42 字数 469 浏览 1 评论 0原文

我正在寻找一种模拟浏览器资源扩展行为的方法。

我试图解决的流程如下:

  • 访问初始 URL(例如 http://example.dmn/ index.htm
  • 解析收到的html响应(例如index.htm)
  • 查找浏览器将通过索引解析获取的资源,例如:
    • 图片
    • 闪光
    • 嵌入视频/音频
    • 框架/iFrame
  • 对找到的每个新资源递归地重复该过程

我不期望跟踪链接 (href),仅在页面首次出现时浏览器将自动获取的页面资源已访问。

您对如何执行此模拟有什么建议吗?

是否有任何可以提供帮助的 Python 项目/库?

谢谢

I'm looking for a way to simulate browser resources expansion behavior.

The flow I'm trying to address is the following:

  • Access an initial URL (e.g. http://example.dmn/index.htm)
  • Parse the html response received (e.g. index.htm)
  • Find the resources that a browser will fetch as a result of the index parsing, e.g.:
    • Images
    • Flash
    • Embedded videos/audio
    • Frames /iFrames
  • Repeat the process recursively for each new resource found

I'm not expecting to follow links (href), only page resources that will be fetched automatically by a browser when the page is first accessed.

Do you have a suggestion how to preform this simulation?

Are there any Python projects/libraries that may help ?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

南巷近海 2024-09-12 17:06:42

您可能希望查看 Windmill 测试框架,它允许您使用 Python 为 Web 应用程序编写测试。

You may wish to look at the Windmill Testing Framework which allows you to write tests in Python for web apps.

贱贱哒 2024-09-12 17:06:42

您可能想查看 spider.py机器人解析器。除非那些自动执行您想要的操作,否则您可以使用 BeautifulSoup 自行深入研究 HTML 汤。

You might want to look at spider.py, and robotparser. Barring those doing what you want automatically, you can dig into the HTML soup yourself with BeautifulSoup.

东京女 2024-09-12 17:06:42

您可能想看看 Scrapy

它可能无法提供您所需的所有功能,但可以轻松扩展以实现此目的。

You may want to take a look at Scrapy.

It may not provide all the exact features you need, but can be easily extended to do so.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文