Trustpilot scrapping Python package. Extract online business reviews and integrate it on your code. It is based on BeautifulSoup.
- Simple searching functionalitites.
- Support the selection of any country available in Trustpilot.
- Extraction of fine-grained data from business reviews.
- Use Trustpilot URLs or local file from where extract the information.
fakepilot is available on Pypi. You can install fakepilot from it with
pip install fakepilot
To install fakepilot from the GitHub source, clone the repository with git
:
git clone https://github.com/phoenixsite/fakepilot.git
Then, change your current directory to the one you cloned and install it with pip
:
cd fakepilot
pip install .
The function search
can be used to mimic the search bar functionality
of Trustpilot. It limits the number of results and you can
indicate whether some reviews should be extracted for each company result.
For example, the following code search for two companies that match
the expression 'starbucks' and two of its reviews.
import fakepilot as fp
fp.search("starbucks", 2, with_reviews=True, nreviews=2)
All the Trustpilot country-specific sites can be used to make the queries. For instance, the Norwegian Trustpilot site can be used:
fp.search("starbucks", 1, country="norge")
If it is required that all the results include a specific parameter, e.g.
the phone number of the company, you can specify it
in the search
function:
fp.search("starbucks", 1, False, 1, "phone", "norge")
Also, the information of a Trustpilot company page can be directly extracted
using get_company
with a given URL or a local file.
The following block extracts ten reviews from the
specified URL:
fp.get_company("https://www.trustpilot.com/review/www.starbucks.com", 10)
The following block extract the information and ten reviews from a local file:
fp.get_company("my_file.html", True, 10)
For a detail description of all the options you can visit the fakepilot's
official documentation site
or you can build yourself
in docs
with Sphinx:
cd docs
make html
I strongly recommend using this scrapper with moderation and carefully. Searching for multiple expressions in a short period of time can generate a lot of requests and connections to the Trustpilot servers and may affect the operation of the website. Be careful, respectful and responsible with scrappers online.