Example #1
0
    def get_scores(self, read):
        """
        fetches raing, bestrating, worstrating, users info from the listing page url
        :param read: read object
        :return: dict
        """
        helper = ScrapeHelper(read)
        by_id = helper.find_by_id('div', 'all-critics-numbers')
        all_critic = {
            'rating':
            self.getCount(helper.ratingValue_in_span(by_id)),
            'bestrating':
            self.getCount(helper.rating_in_meta('bestrating', by_id)),
            'worstrating':
            self.getCount(helper.rating_in_meta('worstrating', by_id)),
            'users':
            self.getCount(
                helper.rating_in_meta('reviewCount ratingCount', by_id))
        }

        audience_score = helper.find_by_class('div', 'audience-score meter')
        avg_audience = {
            'rating':
            self.getCount(helper.ratingValue_in_span(audience_score)),
            'best_rating':
            self.getCount(helper.rating_in_meta('bestrating', audience_score)),
            'worst_rating':
            self.getCount(helper.rating_in_meta('worstrating',
                                                audience_score)),
            'users':
            self.getCount(helper.rating_in_meta('ratingCount', audience_score))
        }
        time.sleep(1)
        return {'all_critic': all_critic, 'avg_audience': avg_audience}
Example #2
0
    def get_scores(self, read):
        """
        fetches raing, bestrating, worstrating, users info from the listing page url
        :param read: read object
        :return: dict
        """
        helper = ScrapeHelper(read)
        by_id = helper.find_by_id("div", "all-critics-numbers")
        all_critic = {
            "rating": self.getCount(helper.ratingValue_in_span(by_id)),
            "bestrating": self.getCount(helper.rating_in_meta("bestrating", by_id)),
            "worstrating": self.getCount(helper.rating_in_meta("worstrating", by_id)),
            "users": self.getCount(helper.rating_in_meta("reviewCount ratingCount", by_id)),
        }

        audience_score = helper.find_by_class("div", "audience-score meter")
        avg_audience = {
            "rating": self.getCount(helper.ratingValue_in_span(audience_score)),
            "best_rating": self.getCount(helper.rating_in_meta("bestrating", audience_score)),
            "worst_rating": self.getCount(helper.rating_in_meta("worstrating", audience_score)),
            "users": self.getCount(helper.rating_in_meta("ratingCount", audience_score)),
        }
        time.sleep(1)
        return {"all_critic": all_critic, "avg_audience": avg_audience}