UNPKG

tiktok-app-api

Version:
80 lines (79 loc) 4.37 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getTagTopContentURL = exports.getTagInfoContentURL = exports.getAudioTopContentURL = exports.getAudioInfoContentURL = exports.getVideoInfoContentURL = exports.getLikedVideosContentURL = exports.getRecentVideosContentURL = exports.getUserInfoContentURL = exports.getTrendingContentURL = void 0; const constants_1 = require("./constants"); const IllegalArgument_1 = require("./errors/IllegalArgument"); function getTrendingContentURL(count, startCur) { return 'https://m.tiktok.com/api/item_list/?count=' + count + '&id=1&type=' + constants_1.TYPE_TRENDING_VIDEOS + '&secUid=&maxCursor=' + startCur + '&minCursor=0&sourceType=12&appId=1233'; } exports.getTrendingContentURL = getTrendingContentURL; function getUserInfoContentURL(identifier) { if (typeof identifier === 'string') { return 'https://www.tiktok.com/node/share/user/@' + identifier + '?appId=1233'; } if (typeof identifier.username === 'undefined') { throw new IllegalArgument_1.IllegalArgument("Passed User must have a username set."); } return 'https://www.tiktok.com/node/share/user/@' + identifier.username + '?appId=1233'; } exports.getUserInfoContentURL = getUserInfoContentURL; function getRecentVideosContentURL(user, count, startCur) { if (typeof user.id === 'undefined') { throw new IllegalArgument_1.IllegalArgument("Passed User must have an id set."); } return 'https://m.tiktok.com/api/item_list/?count=' + count + '&id=' + user.id + '&type=' + constants_1.TYPE_RECENT_VIDEOS + '&secUid=&maxCursor=' + startCur + '&minCursor=0&sourceType=8&appId=1233'; } exports.getRecentVideosContentURL = getRecentVideosContentURL; function getLikedVideosContentURL(user, count, startCur) { if (typeof user.id === 'undefined') { throw new IllegalArgument_1.IllegalArgument("Passed User must have an id set."); } return 'https://m.tiktok.com/api/item_list/?count=' + count + '&id=' + user.id + '&type=' + constants_1.TYPE_LIKED_VIDEOS + '&secUid=&maxCursor=' + startCur + '&minCursor=0&sourceType=9&appId=1233'; } exports.getLikedVideosContentURL = getLikedVideosContentURL; function getVideoInfoContentURL(video) { if (typeof video.id === 'undefined') { throw new IllegalArgument_1.IllegalArgument("Passed Video must have an id set."); } return 'https://m.tiktok.com/api/item/detail/?itemId=' + video.id; } exports.getVideoInfoContentURL = getVideoInfoContentURL; function getAudioInfoContentURL(audio) { if (typeof audio.id === 'undefined') { throw new IllegalArgument_1.IllegalArgument("Passed Audio must have an id set."); } return 'https://m.tiktok.com/api/music/detail/?musicId=' + audio.id + '&language=en'; } exports.getAudioInfoContentURL = getAudioInfoContentURL; function getAudioTopContentURL(audio, count, startCur) { if (typeof audio.id === 'undefined') { throw new IllegalArgument_1.IllegalArgument("Passed Audio must have an id set."); } return 'https://m.tiktok.com/share/item/list?secUid=&id=' + audio.id + '&type=' + constants_1.TYPE_AUDIO_VIDEOS + '&count=' + count + '&minCursor=0&maxCursor=' + startCur + '&shareUid='; } exports.getAudioTopContentURL = getAudioTopContentURL; function getTagInfoContentURL(identifier) { if (typeof identifier === 'string') { return 'https://m.tiktok.com/api/challenge/detail/?challengeName=' + identifier + '&language=en'; } if (typeof identifier.title === 'undefined') { throw new IllegalArgument_1.IllegalArgument("Passed Tag must have a title set."); } return 'https://m.tiktok.com/api/challenge/detail/?challengeName=' + identifier.title + '&language=en'; } exports.getTagInfoContentURL = getTagInfoContentURL; function getTagTopContentURL(tag, count, startCur) { if (typeof tag.id === 'undefined') { throw new IllegalArgument_1.IllegalArgument("Passed Tag must have an id set."); } return 'https://m.tiktok.com/share/item/list?secUid=&id=' + tag.id + '&type=' + constants_1.TYPE_TAG_VIDEOS + '&count=' + count + '&minCursor=0&maxCursor=' + startCur + '&shareUid='; } exports.getTagTopContentURL = getTagTopContentURL;