Title: Stable web scraping: an approach based on neighbour zone and path similarity of page elements

Authors: Peng Gao; Hao Han; Junxia Guo; Motoshi Saeki

Addresses: Laboratory of Information Security and Software Engineering, NARI Group Corporation/State Grid Electric Power Research Institute, No. 8, Nanrui Road, Gulou District, 210003, Nanjing, Jiangsu, China ' Konica Minolta, Tokyo, Japan ' College of Information Science and Technology, Beijing University of Chemical Technology, 4# 15 Beisanhuan East Road, Chaoyang District, Beijing, 100029, China ' School of Computing, Tokyo Institute of Technology, Ookayama 2-12-1-W8-71, Meguro, Tokyo 152-8552, Japan

Abstract: Web scraping techniques based on XPath enable users to consistently extract information of interest from webpages that do not provide a structured interface. However, XPath-based extraction is likely to fail when encountering page variants, resulting in a high cost of repair. Countermeasures based on pattern matching or model learning often require careful pre-processing, which is not suitable for cases where the target data is frequently re-designated. In this paper, we present a new extraction method for the stable scraping of arbitrary designated data from webpages. Instead of attempting to find the desired data directly, we first determine its approximate location in the changed page, called the neighbour zone. Then we search for the precise location by ranking the path similarity of page elements within the neighbour zone. Experiments on a large set of real-world webpages show that our method has better stability for web scraping, compared with the XPath-based extraction. In the two datasets, 0.118 and 0.891 F1-score were increased respectively.

Keywords: webpage; web scraping; semi-structured data extraction; XPath expression; stability; HTML tree; node distance; path similarity.

DOI: 10.1504/IJWET.2018.097561

International Journal of Web Engineering and Technology, 2018 Vol.13 No.4, pp.301 - 333

Published online: 28 Jan 2019 *

Full-text access for editors Full-text access for subscribers Purchase this article Comment on this article