How to scrape rating icon from tripadvisor?

How can I scrape the rating from the TripAdvisor user who evaluates the destination or tourist site? Because of the rating is shown like few bubbles. Does it scrape as an element or other types? Please help. thanks a lot.


Url: https://www.tripadvisor.co.uk/Attraction_Review-g499576-d3474329-Reviews-Ridge_Walk_Mam_Tor_to_Losehill-Castleton_Hope_Valley_Peak_District_National_Park_.html

Sitemap:
{"id":"ridgewalk","startUrl":["https://www.tripadvisor.co.uk/Attraction_Review-g499576-d3474329-Reviews-Ridge_Walk_Mam_Tor_to_Losehill-Castleton_Hope_Valley_Peak_District_National_Park.html"],"selectors":[{"id":"list","type":"SelectorLink","selector":"div.quote a","parentSelectors":["_root"],"multiple":true,"delay":0},{"id":"username","type":"SelectorText","selector":"div#taplc_location_reviews_list_responsive_sur_callout_0.ppr_rup div.username span.expand_inline","parentSelectors":["list"],"multiple":false,"regex":"","delay":0},{"id":"location","type":"SelectorText","selector":"div#taplc_location_reviews_list_responsive_sur_callout_0.ppr_rup div.location span.expand_inline","parentSelectors":["list"],"multiple":false,"regex":"","delay":0},{"id":"reviewdate","type":"SelectorText","selector":"div#taplc_location_reviews_list_responsive_sur_callout_0.ppr_rup div.rating span.ratingDate","parentSelectors":["list"],"multiple":false,"regex":"","delay":0},{"id":"reviewcontent","type":"SelectorText","selector":"div#taplc_location_reviews_list_responsive_sur_callout_0.ppr_rup p.partial_entry","parentSelectors":["list"],"multiple":false,"regex":"","delay":0},{"id":"rating","type":"SelectorElement","selector":"div#taplc_location_reviews_list_responsive_sur_callout_0.ppr_rup div.rating span.ui_bubble_rating","parentSelectors":["list"],"multiple":false,"delay":0}]}

Hi!

You can try to use Element attribute selector on span.ui_bubble_rating (those bubbles), it will give results based on a number of bubbles, if you put class as an attribute:

ui_bubble_rating bubble_10
ui_bubble_rating bubble_20
ui_bubble_rating bubble_30
ui_bubble_rating bubble_40
ui_bubble_rating bubble_50

If you're using Excel afterwards, you can create a formula based on a number of bubbles to represent rating visually.

Corrected sitemap:

{"_id":"ridgewalk2","startUrl":["https://www.tripadvisor.co.uk/Attraction_Review-g499576-d3474329-Reviews-Ridge_Walk_Mam_Tor_to_Losehill-Castleton_Hope_Valley_Peak_District_National_Park.html"],"selectors":[{"id":"list","type":"SelectorLink","selector":"div.quote a","parentSelectors":["_root"],"multiple":true,"delay":0},{"id":"username","type":"SelectorText","selector":"div#taplc_location_reviews_list_responsive_sur_callout_0.ppr_rup div.username span.expand_inline","parentSelectors":["list"],"multiple":false,"regex":"","delay":0},{"id":"location","type":"SelectorText","selector":"div#taplc_location_reviews_list_responsive_sur_callout_0.ppr_rup div.location span.expand_inline","parentSelectors":["list"],"multiple":false,"regex":"","delay":0},{"id":"reviewdate","type":"SelectorText","selector":"div#taplc_location_reviews_list_responsive_sur_callout_0.ppr_rup div.rating span.ratingDate","parentSelectors":["list"],"multiple":false,"regex":"","delay":0},{"id":"reviewcontent","type":"SelectorText","selector":"div#taplc_location_reviews_list_responsive_sur_callout_0.ppr_rup p.partial_entry","parentSelectors":["list"],"multiple":false,"regex":"","delay":0},{"id":"rating","type":"SelectorElementAttribute","selector":"div#taplc_location_reviews_list_responsive_sur_callout_0.ppr_rup div.rating span.ui_bubble_rating","parentSelectors":["list"],"multiple":false,"extractAttribute":"class","delay":0}]}

1 Like