从网站抄袭员工数据 [英] Scraping employee data from websites

查看:331
本文介绍了从网站抄袭员工数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作从不同网页中提取员工数据。我不知道我的网站将被事先提取信息的列表。

I am working on extracting employee data from various webpages. I will not know the list of sites I will be extracting information from beforehand.

例如:

本网站我将试图提取上的此页面

和来自本网站,我需要从的此页面

由于每个站点使用不同的词/方法来显示这些信息,会有人有意见,以什么好办法解决这个问题可能是网站的一个随机列表?

As each site uses different words/methods to display this information, would anyone have advice as to what a good approach to this problem might be for a random list of sites?

感谢您的帮助。

推荐答案

第一个网站是静态的,所以你可以简单地解析与 LXML 或其它XML解析库中的HTML ,但第二个网站的内容是动态的JavaScript从API加载的,所以在这种情况下,你可以从API端点直接获取内容(这是市民:的 https://sqs-hub.s3.amazonaws.com/employee_photos/index.json ),或者如果你想要一个更通用的解决方案,那么你可以使用像硒的webdriver的工具来模拟一个真实的用户,向下滚动页面加载动态内容,然后获取网页的HTML源解析它同样像在第一种情况下。

The first site is static, so you can simply parse the HTML with lxml or other XML parsing library, but the second site's content is loaded dynamically with JavaScript from an API, so in that case you could get the content directly from the API endpoint (it's public: https://sqs-hub.s3.amazonaws.com/employee_photos/index.json) or if you want a more generic solution then you could use a tool like selenium webdriver to mimic a real user, scroll down the page to load the dynamic content and then get the HTML source of the page to parse it similarly like in the first case.

这篇关于从网站抄袭员工数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆