-
Notifications
You must be signed in to change notification settings - Fork 22
/
main.ts
75 lines (58 loc) · 1.94 KB
/
main.ts
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import { TTScraper } from "./BL/Scrapers/TikTokScraper";
/**
* Scrapes the tiktok video info from the given url
* @param url tiktok video url
* @param noWaterMark if video should be without watermark
* @returns Video
*/
export async function fetchVideo(url: string, noWaterMark?: boolean) {
if (!url) throw new Error(`You must provide a Tiktok video url!`);
return await new TTScraper().video(url, noWaterMark);
}
/**
* Scrapes the given user page and returns all available info
* @param username tiktok username of a user
* @returns User
*/
export async function fetchUser(username: string) {
if (!username) throw new Error(`You must provide a username!`);
return await new TTScraper().user(username);
}
/**
* Scrapes a user page and returns a list of all videos for this user
* @param username tiktok username of a user
* @returns IVideo[]
*/
export async function fetchAllVideosFromUser(username: string) {
if (!username) throw new Error(`You must provide a username!`);
return await new TTScraper().getAllVideosFromUser(username);
}
/**
* Scrapes the given Link and returns information about the Music of the Video
* @param url tiktok video url
* @returns Music
*/
export async function fetchMusic(url: string) {
if (!url) throw new Error(`You must provide a Tiktok video url!`);
return await new TTScraper().getMusic(url);
}
/**
* Returns direct download link for the tiktok video with no watermark!
* @param url tiktok video url
* @returns
*/
export async function fetchVideoNoWaterMark(url: string) {
if (!url) throw new Error(`You must provide a Tiktok video url!`);
return await new TTScraper().noWaterMark(url);
}
/**
* Scrapes a hashtag posts
* @param tag tiktok hashtag
* @returns Promise<IVideo[]>
*/
export async function hashtag(tag: string) {
if (!tag) throw new Error(`You must provide a tiktok hashtag`);
return await new TTScraper().hashTag(tag);
}
export * from "./BL";
export * from "./Interfaces";