Beispiel #1
0
def main():

    parser = argparse.ArgumentParser()

    parser.add_argument("--blog", help="导出日志数据", action="store_true")
    parser.add_argument("--msgboard", help="导出留言板数据", action="store_true")
    parser.add_argument("--photo", help="导出相册数据", action="store_true")
    parser.add_argument("--shuoshuo", help="导出说说数据", action="store_true")
    parser.add_argument("--like",
                        help="[deprecated]导出点赞数据,需要设置--photo或--shuoshuo",
                        action="store_true")
    parser.add_argument("--download",
                        help="下载图片或视频至本地,需要先导出说说或相册的json数据",
                        action="store_true")

    parser.add_argument("--all", help="导出所有数据", action="store_true")

    args = parser.parse_args()

    if args.like and not (args.shuoshuo or args.photo):
        print("选项错误")
        return

    target_uin = ""
    self_uin = ""
    cookies_value = ""
    g_tk = ""  # 可选,为空则通过 cookies 中的 p_skey 计算

    p_skey_string = "p_skey="
    while not test_uin_valid(target_uin):
        target_uin = input("请输入需要导出数据的QQ号:")
    while not test_uin_valid(self_uin):
        self_uin = input("请输入用于登录的QQ号:")
    while True:
        if len(cookies_value) == 0:
            cookies_value = input("请输入 cookies:")
        pos = cookies_value.find(p_skey_string)
        p_skey_start = pos + len(p_skey_string)
        p_skey_end = cookies_value.find(";", p_skey_start)
        p_skey_end = p_skey_end if p_skey_end >= 0 else len(cookies_value)
        p_skey = cookies_value[p_skey_start:p_skey_end]
        g_tk = str(calc_g_tk(p_skey))
        if len(g_tk) > 0:
            break

    q = QzoneExporter(self_uin, g_tk, cookies_value, args, target_uin)
    q.export()

    print("done")
    return
Beispiel #2
0
def home():
    uins = []
    files = os.listdir(".")
    for f in files:
        if os.path.isdir(f) and test_uin_valid(f):
            uins.append(f)

    return render_template(QzoneFileName.PREVIEW_HTML, uins=uins)
Beispiel #3
0
def uin_home(uin):
    if not test_uin_valid(uin) or not os.path.exists(uin):
        return redirect(url_for("home"))
    generator = global_get(uin, QzoneGenerator(uin, download_if_not_exist))
    return generator.generate_home()