Git Product home page Git Product logo

british-airways-reviews-scraper-python's Introduction

British-airways-reviews-scraper-python

Python Data Scraper to scrape the reviews from the British Airways websites

This is a web scraping code in Python using the libraries pandas and requests along with BeautifulSoup. The code scrapes review ratings and reviews of the British Airways from the website airlinequality.com.

The code first defines the base_url to the reviews page of British Airways and the number of pages to be scraped (pages). The page_size is set to 100. Then, two empty lists are created reviews and ratings to store the scraped data.

In the for loop, the code generates the URL for each page, makes a GET request to the URL, and collects the HTML content. The HTML content is then parsed using the BeautifulSoup library. The code finds all the

elements with the itemprop attribute set to "reviewRating" to scrape the ratings. The ratings are extracted from the element with the itemprop attribute set to "ratingValue".

In the next step, the code finds all the

elements with the class "text_content" to extract the reviews. After the for loop, the code checks if the number of reviews is equal to the number of ratings, if not, the difference is calculated, and 0 is appended to the ratings list the same number of times as the difference.

Finally, the scraped ratings and reviews are stored in a pandas DataFrame and written to a CSV file named British_Aiways-reviews.csv.

In summary, this code scrapes the reviews and ratings of British Airways from the airlinequality.com website and stores the data in a CSV file for future use.

british-airways-reviews-scraper-python's People

Contributors

danishjameel avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.