def get_random_html_file_name(self): u""" 生成一个随机html :return: :rtype: """ filename = ExtraTools.md5(str(uuid.uuid4())) + '.xhtml' return filename
def create_filename(self, href): u""" 根据 href 创建md5编码之后的文件名 :param href: :return: """ filename = ExtraTools.md5(href) + '.jpg' return filename
def get_cookie(self): filename = ExtraTools.md5(ExtraTools.get_time()) with open(filename, 'w') as f: pass self.cookieJar.save(filename) with open(filename) as f: content = f.read() os.remove(filename) return content
def create_filename(self, href): filename = ExtraTools.md5(href) + '.jpg' return filename
def parse_article_id(self): from src.tools.extra_tools import ExtraTools article_id = ExtraTools.md5(self.info['title']) self.info['article_id'] = article_id