weibo-crawler icon indicating copy to clipboard operation
weibo-crawler copied to clipboard

抓取的微博头条文章url为空

Open sushengbuhuo opened this issue 3 years ago • 3 comments
trafficstars

抓取的uid 5044429589(填了cookie) ,抓的excel里头条文章url都是空的,不知道什么问题? image

sushengbuhuo avatar Apr 14 '22 02:04 sushengbuhuo

可能现在的代码还存在bug,我现在不方便调试,到时候再看看。

dataabc avatar Apr 14 '22 14:04 dataabc

改了下可以了

def get_article_url(self, selector):
        """获取微博中头条文章的url"""
        article_url = ''
        text = selector.xpath('string(.)')
        if text.startswith(u'发布了头条文章'):
            url = selector.xpath('//a/@href')
            if url and url[0].startswith('https://'):
                article_url = url[0]
        return article_url

sushengbuhuo avatar Apr 15 '22 08:04 sushengbuhuo

感谢反馈并给出了解决方法。如果方便,您可以以pull request的方式提交代码吗?这样你可以成为本项目的contributor,这不是强制的,如果不方便,我在以后自己修改。再次感谢。

dataabc avatar Apr 15 '22 14:04 dataabc