-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.py
38 lines (28 loc) · 975 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import os
import os.path as osp
import argparse
from core import BackupEngine
def parse_args():
parser = argparse.ArgumentParser(description="Back up for QQ Zone")
parser.add_argument('--account', type=str, help="QQ account")
parser.add_argument('--save', type=str, default='./QQZone', help="Directory to save data")
parser.add_argument('--visual', action='store_true', help="Not use headless mode")
args = parser.parse_args()
args.save = osp.join(args.save, args.account)
if not osp.exists(args.save):
os.makedirs(args.save)
return args
def main():
args = parse_args()
engine = BackupEngine(args.account, save_dir=args.save, headless=args.visual)
try:
engine.download_images()
engine.download_posts()
engine.download_leaving_message()
engine.download_diary()
except Exception as e:
print(e)
finally:
engine.finished()
if __name__ == "__main__":
main()