Beispiel #1
0
    parser.add_argument('--db', default='decrypted.db', help='path to decrypted database')
    parser.add_argument('--avt', default='avatar.index', help='path to avatar.index file')
    parser.add_argument('--res', default='resource', help='reseource directory')
    args = parser.parse_args()
    return args

if __name__ == '__main__':
    args = get_args()

    name = ensure_unicode(args.name)
    output_file = args.output

    parser = WeChatDBParser(args.db)

    try:
        chatid = parser.get_id_by_nickname(name)
    except KeyError:
        sys.stderr.write(u"Valid Contacts: {}\n".format(
            u'\n'.join(parser.all_chat_nicknames)))
        sys.stderr.write(u"Couldn't find the chat {}.".format(name));
        sys.exit(1)
    res = Resource(parser, args.res, args.avt)
    msgs = parser.msgs_by_chat[chatid]
    print "Number of Messages: ", len(msgs)
    assert len(msgs) > 0

    render = HTMLRender(parser, res)
    htmls = render.render_msgs(msgs)

    if len(htmls) == 1:
        with open(output_file, 'w') as f:
Beispiel #2
0
                        default='resource',
                        help='reseource directory')
    args = parser.parse_args()
    return args


if __name__ == '__main__':
    args = get_args()

    name = ensure_unicode(args.name)
    output_file = args.output

    parser = WeChatDBParser(args.db)

    try:
        chatid = parser.get_id_by_nickname(name)
    except KeyError:
        sys.stderr.write(u"Valid Contacts: {}\n".format(u'\n'.join(
            parser.all_chat_nicknames)))
        sys.stderr.write(u"Couldn't find the chat {}.".format(name))
        sys.exit(1)
    res = Resource(parser, args.res, args.avt)
    msgs = parser.msgs_by_chat[chatid]
    print "Number of Messages: ", len(msgs)
    assert len(msgs) > 0

    render = HTMLRender(parser, res)
    htmls = render.render_msgs(msgs)

    if len(htmls) == 1:
        with open(output_file, 'w') as f:
Beispiel #3
0
                        default='decrypted.db',
                        help='path to decrypted database')
    parser.add_argument('--res',
                        default='resource',
                        help='reseource directory')
    args = parser.parse_args()
    return args


if __name__ == '__main__':
    args = get_args()
    parser = WeChatDBParser(args.db)
    res = Resource(parser, args.res, '')

    try:
        chatid = parser.get_id_by_nickname(args.name)
    except KeyError:
        sys.stderr.write(u"Valid Contacts: {}\n".format('\n'.join(
            parser.all_chat_nicknames)))
        sys.stderr.write(u"Couldn't find the chat {}.".format(args.name))
        sys.exit(1)

    msgs = parser.msgs_by_chat[chatid]
    print(f"Number of Messages for {args.name}: ", len(msgs))
    assert len(msgs) > 0

    voice_msgs = [m for m in msgs if m.type == TYPE_SPEAK]
    for idx, m in enumerate(voice_msgs):
        audio_str, duration = res.get_voice_mp3(m.imgPath)
        audio_bytes = base64.b64decode(audio_str)
        outf = f'/{args.output}/{idx:04d}-{duration:.1f}s.mp3'