-
Notifications
You must be signed in to change notification settings - Fork 118
Expand file tree
/
Copy pathtest_music.py
More file actions
30 lines (22 loc) · 788 Bytes
/
test_music.py
File metadata and controls
30 lines (22 loc) · 788 Bytes
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
import argparse
from TikTokAPI import TikTokAPI
from utils import read_json_from_file
def getMusic(music_id):
api = TikTokAPI(read_json_from_file("cookie.json"))
return api.getMusic(music_id)
def getVideosByMusic(music_id):
api = TikTokAPI(read_json_from_file("cookie.json"))
return api.getVideosByMusic(music_id, count=10)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='')
parser.add_argument('--data', dest='data', type=str, help='music/videos')
args = parser.parse_args()
var = "6704854531001289474"
if args.data == 'music':
retval = getMusic(var)
print(retval)
elif args.data == 'videos':
retval = getVideosByMusic(var)
print(retval)
else:
print("Invalid Argument")