Ejemplo n.º 1
0
 def parse_follower_count(self):
     u"""
     获取关注人数
     """
     dom = self.node.select(
         u'div.zg-gray-normal a[data-za-l="collection_followers_count"]')[0]
     follower_count = Tag.get_content(dom)
     self.set_attr("follower_count", follower_count)
     return
Ejemplo n.º 2
0
 def parse_update_date(self):
     u"""
     获取最近更新日期
     """
     dom = self.node.select(u"div.zg-gray-normal span.time")[0]
     raw_update_date = Tag.get_content(dom)
     update_date = Match.parse_date(raw_update_date)
     self.set_attr("update_date", update_date)
     return
Ejemplo n.º 3
0
    def parse_creator_name(self, dom):
        u"""
        dom => div#zh-single-answer-author-info
        获取用户名

        :param dom: 用户信息节点
        :type dom: bs4.Tag
        :return:
        :rtype: None
        """
        text_tag = dom.select(u"h2.zm-list-content-title a")[0]
        name = Tag.get_content(text_tag)
        self.set_attr("name", name)
        return
Ejemplo n.º 4
0
    def parse_creator_name(self, dom):
        u"""
        dom => div#zh-single-answer-author-info
        获取用户名

        :param dom: 用户信息节点
        :type dom: bs4.Tag
        :return:
        :rtype: None
        """
        text_tag = dom.select(u"h2.zm-list-content-title a")[0]
        name = Tag.get_content(text_tag)
        self.set_attr("name", name)
        return
Ejemplo n.º 5
0
    def parse_creator_headline(self, dom):
        u"""
        dom => div#zh-single-answer-author-info
        获取用户签名

        :param dom: 用户信息节点
        :type dom: bs4.Tag
        :return:
        :rtype: None
        """
        # 签名tag一定存在
        text_tag = dom.select(u"div.zg-gray-normal")[0]

        headline = Tag.get_content(text_tag)
        self.set_attr("headline", headline)
        return
Ejemplo n.º 6
0
    def parse_creator_headline(self, dom):
        u"""
        dom => div#zh-single-answer-author-info
        获取用户签名

        :param dom: 用户信息节点
        :type dom: bs4.Tag
        :return:
        :rtype: None
        """
        # 签名tag一定存在
        text_tag = dom.select(u"div.zg-gray-normal")[0]

        headline = Tag.get_content(text_tag)
        self.set_attr("headline", headline)
        return
Ejemplo n.º 7
0
 def set_up(self):
     title = Tag.get_content(self.node)
     self.set_attr(u"title", title)
     return