抓取具有多个深度的维基百科子类别(页面)?
Scraping Wikipedia Subcategories (Pages) with Multiple Depths?
如果您在维基百科 (https://en.wikipedia.org/wiki/Category:Computer_science), it displays a total of 19
subcategories (https://en.wikipedia.org/wiki/Category:Computer_science). Now, for all these 19
subcategories, if I want to extract
only the page names (the titles of pages). For example Pages in category Computer science
has 45
pages which is displayed as bullets
just below the wikipedia subcategories list. Now for all the other associated subcategories, for example the Areas of computer science
is a subcategory with 3
pages (https://en.wikipedia.org/wiki/Category:Areas_of_computer_science). But, again it has 17 sub-categories (i.e. depth 1, considering the traversal, i.e. depth = 1 means, we are 1 deep). Again, algorithm and data structures
(https://en.wikipedia.org/wiki/Category:Algorithms_and_data_structures) having 5
pages, and artificial intelligence
(https://en.wikipedia.org/wiki/Category:Artificial_intelligence) 中打开 computer science category
,其中有 333
个页面,其中一些额外的 categories
和 subcategories
跨越多个页面(请参阅类别 "Artificial intelligence") 中的页面有 37 个类别和 333 个页面,这样列表会更深入。我们现在进入深度 2。我需要提取所有页面(标题)以进行深度 1 和深度 2 的遍历。是否存在任何算法可以实现相同的目的?
例如:计算机科学的子类别区域再次有一些 (17) 个子类别,总页数为 5+333+127+79+216+315+37+47+95+37+246+考虑到所有 (17) 个子类别,103+21+2+55+113+94 页。这是深度 2,因为我切换了两次列表。同样,对于基本根计算机科学,深度为 2 的其余 18 个子类别 (https://en.wikipedia.org/wiki/Category:Computer_science) 也需要合并相同的内容?
有什么方法可以实现吗?显示和提取那么多页面很困难,因为它会很大。因此,10,000 页的最大门槛是绝对可以的。
有没有办法做到这一点?非常感谢任何小小的帮助!
有一个由维基媒体实验室托管的名为 PetScan 的工具。您可以轻松输入类别标题,然后 select 您想要达到的深度,然后就大功告成了! https://petscan.wmflabs.org/
另外,看看它是如何工作的https://meta.m.wikimedia.org/wiki/PetScan/en
如果您在维基百科 (https://en.wikipedia.org/wiki/Category:Computer_science), it displays a total of 19
subcategories (https://en.wikipedia.org/wiki/Category:Computer_science). Now, for all these 19
subcategories, if I want to extract
only the page names (the titles of pages). For example Pages in category Computer science
has 45
pages which is displayed as bullets
just below the wikipedia subcategories list. Now for all the other associated subcategories, for example the Areas of computer science
is a subcategory with 3
pages (https://en.wikipedia.org/wiki/Category:Areas_of_computer_science). But, again it has 17 sub-categories (i.e. depth 1, considering the traversal, i.e. depth = 1 means, we are 1 deep). Again, algorithm and data structures
(https://en.wikipedia.org/wiki/Category:Algorithms_and_data_structures) having 5
pages, and artificial intelligence
(https://en.wikipedia.org/wiki/Category:Artificial_intelligence) 中打开 computer science category
,其中有 333
个页面,其中一些额外的 categories
和 subcategories
跨越多个页面(请参阅类别 "Artificial intelligence") 中的页面有 37 个类别和 333 个页面,这样列表会更深入。我们现在进入深度 2。我需要提取所有页面(标题)以进行深度 1 和深度 2 的遍历。是否存在任何算法可以实现相同的目的?
例如:计算机科学的子类别区域再次有一些 (17) 个子类别,总页数为 5+333+127+79+216+315+37+47+95+37+246+考虑到所有 (17) 个子类别,103+21+2+55+113+94 页。这是深度 2,因为我切换了两次列表。同样,对于基本根计算机科学,深度为 2 的其余 18 个子类别 (https://en.wikipedia.org/wiki/Category:Computer_science) 也需要合并相同的内容?
有什么方法可以实现吗?显示和提取那么多页面很困难,因为它会很大。因此,10,000 页的最大门槛是绝对可以的。
有没有办法做到这一点?非常感谢任何小小的帮助!
有一个由维基媒体实验室托管的名为 PetScan 的工具。您可以轻松输入类别标题,然后 select 您想要达到的深度,然后就大功告成了! https://petscan.wmflabs.org/
另外,看看它是如何工作的https://meta.m.wikimedia.org/wiki/PetScan/en