










































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!











































LAB UNIVERSITY OF APPLIED SCIENCES LTD Bachelor of Business Administration Degree programme in Business Information Technology Autumn 2020 Thao Ho
Abstract Author(s) Ho, Hoang Phuong Thao Type of publication Bachelor’s thesis Published Autumn 2020 Number of pages 45 Title of publication Leveraging Web Scraping For Collecting Competitive Market Data Case: A case study of an Airbnb rental unit in Helsinki Name of Degree Bachelor of Business Administration Abstract In recent years, web scraping has become a popular technique to gather large amounts of data from many sources. The study focused on the exploration advantages of web scraping in the market re- search process for a small rental business. The business has existing market re- search that still contains several manual steps and limitations inaccuracy. The objec- tive of this thesis was to introduce and examine how web scraping could support a small rental business in the market research process. The research framework for this thesis was a constructive research approach that helped to fill the gap between theo- retical background and practical problem. The definition of web scraping was applied in the market research process, and the implementation process used both qualitative and quantitative research methods. The thesis was carried out within the scope of a small rental business. The research applied qualitative research by having interviews with potential users of the case study, reviewed the existing market research process, and then analyzed the pro- cess's performance with web scraping. The interviews were adopted to collect the views of participants about the web scraper and their feedbacks. By applying web scraping, the author was able to identify the advantages gained in time productivity and efficiency in the market research process. Moreover, the study presented the implementation of a simple web scraper with Python for small rental businesses. The implementation process was reviewed by potential users and ad- justed to meet the case study’s needs better. Keywords web scraping, web scraper, data, market research, Beautiful Soup
AI – Artificial Intelligence CRA – Constructive Research Approach CSS – Cascading Style Sheets HTML – Hypertext Markup Language URL – Uniform Resource Locator UI – User Interface
This chapter presents the research's motivation, research questions, the limita- tions of the study, the research approach, and the structure of the thesis. Also, the data collection and analysis of this thesis are discussed in this chapter. 2.1 Thesis motivation Data analytics is now widely used in various industries, also in the hospitality in- dustry. It is becoming one of the most critical aspects for companies to take a competitive advantage in the market. For instance, from 2013 to 2014, Red Roof Inn, a hotel chain in the United States, could predict flight cancellations and launched an effective marketing campaign by gathering public weather data and flight information. (Bhattacharjee et al. 2017) The hospitality industry includes hotels and relative services with the same con- cept, for example Airbnb could benefit from using web data. There are currently many aggregation websites that offer all information regarding accommodation, such as Tripadvisor.com, Kayak.com, Airbnb.com, and Booking.com. Technology likes web scraping can help business owners gather and analyze data from these sources. Python is considered the most popular programming language for web scraping when it could smoothly handle the data extraction process and provide a wide se- lection of web scraping frameworks (Koshy 2020). Scrapy and BeautifulSoup are two frameworks that are usually chosen to scrape data because of outstanding performance. This thesis reviews existing web scraping frameworks and selects the most suitable framework for creating the case study's web scraper application. 2.2 Research questions The thesis discusses the traditional market research of rental businesses, then finds some effective ways to increase the efficiency of the process. The primary goal of this thesis is to explore the advantages of web scraping to the market re- search process through a case study of building a web scraping application for Airbnb hosts to collect data in the market. In specific, collecting competitors’ data
is helpful for one business owner to adjust the price, improve the customer experi- ence as well as marketing campaign planning. This research aims to create a so- lution for the case study by answering the main research question as stated below:
2.4 Research approach This thesis aims to apply web scraping technologies in the market research pro- cess to gather data for Airbnb hosts. Hence, the author decided to implement a constructive research method that is used to fill the gap between academic theory and practical problems. An alternative to a constructive research approach could be design science re- search, but as CRA includes market testing in the implementation stage (Lind- holm, 2008), CRA was chosen. Kasanen (1993) presents that the constructive re- search approach should always start with a practical research problem and be fol- lowed by the below steps:
In this paper, the thesis starts with reviewing existing web scraping frameworks, then develops and tests these options to build a scraper for a case study that was mentioned in the thesis motivation part. As several concerns arise during the study case, abductive is used to explain these redirections. Following the abductive rea- soning approach, the research aims to evaluate applicable results as well as re- flect on the relationship between theories and practical work. 2.5 Research methods There are three main research methods to demonstrate the solution in the con- structive research approach: qualitative research, quantitative research, or the combination of two of them. (Oyegoke 2011) There are two common research methodologies: qualitative and quantitative. They depend on ways of collecting data and analysis as well as they help to answer dif- ferent kinds of research questions. Qualitative research is presented under words to understand single concepts or phenomena, and interviews play an important role in executing this research method. Miles and Huberman (1994) also mention that qualitative research provides relevant ways to draw conclusions and verify it. Image 1 The formulation of abductive reasoning approach (Samim 2020)
gather the user’s opinions on the implementation of web scraping to the market re- search process. The interview section consists of different open-ended questions that require specific responses. Therefore, the qualitative research method was adopted to collect and analyze these open-ended questions. Also, the quantitative research method was applied to compare the performance of the existing market process and the new one with web scraping. The performance could be estimated based on data volume, time, and speed. These collected data aimed to help an- swer the thesis’ research questions and provided ideas to improve the case study. 2.7 Thesis structure Figure 1 presents the structure of this thesis. The thesis is divided into six chap- ters. In Chapter 1, the thesis introduces the topic and research background. Chap- ter 2 demonstrates the motivation why the thesis is conducted, identifies the main objectives, and the foundation of research questions. Also, the research approach, research method, data collection, and the limitations of this study are explained in this chapter. Next, Chapter 3 explores the theory of the research. This section fo- cuses on web scraping, its framework (Scrapy and BeautifulSoup), and legal is- sues. These information helps build the theoretical foundation of how web scrap- ing could support the market search process for small rental businesses. Chapter
Figure 1. Thesis Structure
4 shows the case study, the implementation, the result, and explains how the per- formance of the implementation could help answer research questions. Chapter 5 presents the data collection as well as presents the results of the analysis. Chap- ter 6 finalizes the whole research and answers initial research questions. At the end of this chapter, several suggestions for further development are also given. Chapter 7 summarizes the whole research and provides research conclusions.
problem, defines specific research approaches, required data, sampling plans, the budget for the research, and how the results support the decision-making. 3.1.3 Collect relevant data and information This is the core of the market research, which is used to collect data through pub- lic sources, surveys, conducting interviews, field testing, etc. Most of the collected data will be answers, choices, observations that are then stored in spreadsheet format for further analysis (Market Research Guy 2020). The collection of data plays an important role in decisions that businesses will make later. However, it will take a lot of time if one business wants to extract a large amount of competi- tors’ data from public sources by copying and pasting data manually. 3.1.4 Analyze data After gathering all relevant data, the last step aims to make the collected data speak through structured tables, visualizations with the help of Excel or business intelligence tools such as Power BI, Tableau, Google Analytics. Analyzing data aims to look for trends of the market, specific conclusions that support the last de- cision. 3.2 Introduction to web scraping Web Scraping is known as a technique used to extract data from multiple sources to simple flat files or databases that make further analysis and visualization easier (Sirisuriya 2015, 135). In the past, the only method to collect data from websites is copy-and-paste data manually. Good practical examples of web scraping could be competitive market research, price intelligence, and content monitoring. Web scraping is also known as web harvesting, web data extraction or web data mining can be defined as a technique used to extract data from websites through an automated process. In other words, this process aims to copy data automati- cally from websites and deliver them to a database that could be structured or un- structured database. Generally, web scraping could be executed by writing an au- tomated program which is a web scraper. The web scraper queries a web server and request data under format like HTML and XML format, then parses that data to extract needed information. Figure 3 illustrates the structure of the web scraping
process. Web scraping has been a popular technique in the business world that includes not only big corporations but also startups. As data is a priceless asset for compa- nies and organizations, web scraping allows the business owner to quickly gather vast amounts of data from online sources. This is the core of the market research and business strategy, for instance, gathering product reviews, social networking posts, or comparing competitive prices. 3.3 Web scraping components There are four main components included in the web scraping: Crawler; Parse and Extract; Format; and Storage Module. Figure 4 presents how web scraping’s com- ponents are used in the scraping process under simple steps. Targeted Websites (HTML Page) Web Scraping Technique Structured Data Figure 3. Web scraping process Crawler – Document Load Parsing and Extraction Format Storage Figure 4. Web scraping working flow
Scrapy (Python), BeautifuSoup (Python), Goutte (PHP), etc. In this section, the thesis focuses on discussing Scrapy, BeautifulSoup, and how they can be applied in variety situations. 3.4.1 BeautifulSoup BeautifulSoup is a pure open-source Python library developed by Leonard Rich- ardson, which is mainly used for HTML and XML file parsing. It provides methods to search elements and extract structured data from a website and saves program- mers a lot of time since it could collaborate with common parsers such as lxml or html 5 lib to provide a solution to navigate, search and modify the parse tree. Beautiful Soup is a more streamlined version than its brother, which is Scrapy and could be used for simpler web scraping projects. It can parse HTML and XML doc- uments and bring simple methods to work with DOM (Document Object Model). In addition, Beautiful Soup has the capacity of exporting fetched documents to Unicode or UTF-8. 3.4.2 Scrapy Scrapy is a web scraping framework for Python and useful for various of purposes such as data mining, information processing, or historical archival. Scrapy is more powerful than Beautiful Soup as it is usually used for large scale web scraping. Scrapy offers a complete package for downloading web pages, processing inside content, and converting to readable files or databases. Developing web scraper with Scrapy is quite easy to follow, the important thing is to create the parse() func- tion to deal with downloaded data and return scraped data. 3.4.3 Lxml Lxml is a Python library and is one of the fastest libraries for processing XML and HTML. This library is built on top of the libxml2 XML parsing library written in C which combines the speed of the native C library and the simplicity of Python (Fatenaite 2020). Python lxml can be used to create XML and HTML documents, find specific elements.
3.4.4 Other frameworks Selenium In the beginning, Selenium is widely used for website testing (Mottet 2018). Also, this library could be used as a web scraping library and allows users to control a web browser and automate different events such as clicking and scrolling. While Scrapy or Requests cannot work well with websites written in JavaScript, Sele- nium has good performances with JavaScript events and can control web brows- ers such as Chrome, Safari, or Firefox by combining with WebDriver protocol. 3.5 Web scraping as a service Web scraping as a service is a term for executing the data extraction without re- quired coding knowledge. From big corporations to startups and tiny businesses, web scraping as a service provides several solutions such as price tracking, social media monitoring, information aggregation. The service allows users to collect data from online sources within a few clicks in the same way as using softwares. Some of the common web scraping services are Octoparse.com, Parsehub.com, and Scrapinghub.com. One of the big limitations of web scraping service is pricing. The cost depends on the numbers of websites to be scraped, complexity, frequency of scraping, mainte- nance as well as customer support service. While big companies could consider web scraping service to be a good option to replace humans, small businesses need to work on the budget. For these reasons, this thesis aims to create a simple web scraper self-service that shares the difficulties with small businesses in the hospitality industry. 3.6 Website structure Web scraping approaches depend on website structures. Websites store data in two main ways that are Hypertext Markup Language (HTML) elements and Appli- cation Programming Interface (API). Hypertext Markup Language (HTML) Hypertext Markup Language (HTML) could be seen as a backbone that describes