hackpad_mail_processor.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:hackpad-email-reader 作者: Stek-io 项目源码 文件源码
def extract_url(self, text):
        """
        Extract Hackpad Archive URL from a text

        :param text:
        :return: the located URL as a string
        """
        archive_url = None
        regexes = [
            re.compile('https:\/\/[A-Za-z0-9\.-]*hackpad-export\.s3[^"]*(?=")'),
            re.compile('https:\/\/[A-Za-z0-9\.-]*hackpad-export\.s3[^>]*(?=>)')
        ]
        for r in regexes:
            matches = r.findall(text)

            if matches:
                archive_url = html.unescape(matches[0])
                self._logger.info("Located download URL: %s" % archive_url)
                break

        return archive_url
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号