Exemple #1
0
    def get_thread_info(cls, url, res):
        obj = cls(url, res)
        tip = cls._thread_res_to_tip(res, obj.pd)

        text = sanitize.clean(obj.get_div_content_text(tip))
        link = obj.get_thread_link(tip, url)
        response_num = int(obj.get_div_response_num(tip))
        image_url = obj.get_div_image(tip) if obj.show_image else ''

        result = ResultInfo(text=text, link=link, response_num=response_num, image_url=image_url)

        return result
Exemple #2
0
    def island_split_page(self):
        """
        must return list of ResultInfo instance
        """
        results = []

        pd = self.pd
        tips = self.get_tips(pd)
        for tip in tips:
            response_num = int(self.get_div_response_num(tip))
            link = self.complete_link(self.get_div_link(tip))
            text = self.get_div_content_text(tip)
            text = sanitize.clean(text)
            image_url = self.get_div_image(tip) if self.show_image else ''

            result = ResultInfo(text=text, link=link, response_num=response_num, image_url=image_url)
            results.append(result)

        return results