szdc / tiktok-api Goto Github PK
View Code? Open in Web Editor NEWUnofficial API wrapper for TikTok
License: MIT License
Unofficial API wrapper for TikTok
License: MIT License
i am only being able to login, data of my account is fetching but whenever i try to use any other feature as listing post or something like that i always i get undefined, even tho i define it as you said.
Currently the API only has a helper method for logging in with an email address. Users also have the option to use their username, so add a helper method for this.
Is your feature request related to a problem? Please describe.
The Post interface is missing several parameters that have been added in recent updates, e.g. sticker_detail
, which describes the filter that was used with a video.
Describe the solution you'd like
Add any new interesting/relevant fields. There are fields like cmt_swt
and label_top
which are missing but don't seem relevant at this point in time so can be left out.
The call to searchUsers()
is currently failing if type
is not specified, even though it's marked as optional. This API should set a default value of 1.
The search interface in the app lists popular hashtags - add the API call that does this.
First of all, you've done an amazing job. Well done.
I am looking at this api now: .listPosts(params)
It seems to me it is limited to get posts based on users according to your param example.
api.listPosts({
user_id: '<user_id>',
max_cursor: 0,
})
.then(res => console.log(res.data.aweme_list))
.catch(console.log);
So my question is, can we get all posts regardless of users?
Your answer would be appreciated.
Regards!
hello device_id how do I create it?
At the moment you have to login every time you start a new instance of the API. Sessions last longer than that, so we should have the ability to load and use an existing session.
Please reply to me if you have time
If you try to generate fresh device details you're unable to login successfully until device is registered with api it seems. You can use the same device for multiple accounts however you hit request limits extremely quickly. I see that the app makes an api call to register a new device however the data it posts seems to be encrypted. any idea on what is being sent over to the api during this post call?
Does the function use the current time to generate the mas parameter?
export interface AntiSpamParams {
/** A 20-character anti-spam parameter */
as: string;
/** A 20-character anti-spam parameter */
cp: string;
/** An encoded version of the 'as' anti-spam parameter */
mas: string;
}
how to create as and mas param?
The latest official version this API supports is 8.2.0, which was released back in August 2018 (though the API still works with 9.1.0). The official API calls now include an x-tt-token
(sourced from the login response headers), as well as several more metadata parameters (e.g. pass-region
, pass-route
). The app_name
has also changed from normal
to musical_ly
.
All of these should be added to the API.
using api, i get a successful response however follow isn't actually created. I can confirm that while using MeMu emulator upon clicking follow button it says following however viewing that users profile i still see follow button. On my profile follower count increases yet user is not within follower list. tiktok must be recognizing something from both api code and emulator and stopping follow action behind the scenes.
Hi,
Is it possible to get a list of "For You" videos similar to what we get in the .listPosts ?
I am assuming that .listPosts only lists videos of the current user_id. Would be good to list all videos for all users, as they appear in the "For You" page screen.
For example:
.listForYouPosts(params)
Lists posts for the user's For You page.
api.listForYouPosts({
user_id: '<user_id>',
max_cursor: 0,
})
.then(res => console.log(res.data.aweme_list))
.catch(console.log);
// Outputs:
// [{ author: {...}, aweme_id: '999', desc: 'description', music: {...}, statistics: {...}, video: {...} },
Do you have any plans to add endpoints for live streams on Tiktok?
Thank you for all of the work you have put into the current api. I would like to know if it would be possible to implement access to viewing a users qr code via username or userid?
Hello Jack , I want use to Tiktok api but i did not understand Spam Parameters and have a question , does api working now ?
Any ideas on this? They seem to be renewed with every request and they also seem to be required for every API call I've tried...
I've found a function appendAntiSpamParams
and I've recreated the byteArrayToHexStr
function but a) I don't see anywhere where the ts
argument is used (and it must be because if it was just based off of the deviceId
, the spam params would be the same every time) and b) there's some sort of encoding that happens before the hex function and I lost the will to persevere, trying to navigate their code.
Is there any way to search popular videos by hashtag/query
Hello,
First of all, thanks for such an amazing work you have put in into this API.
I am currently trying to implement this API on an ASP.NET server, with some success. But aweme/v1/user/follower/list/
is giving me a headache. I receive empty response when calling it using HttpClient
on my ASP.NET server. I use the parameters from my own device, and can get my followers on Postman with no issues. Doesn't work in C#.
This is the code I use:
bool hasMore = true;
int maxTime = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds;
string request = $"https://api2.musical.ly/aweme/v1/user/follower/list/?{params}";
using (HttpClient client = new HttpClient(new HttpClientHandler() { AutomaticDecompression = DecompressionMethods.Deflate }))
{
var req = new HttpRequestMessage(HttpMethod.Get, request);
var response = await HttpClient.SendAsync(req);
using (Stream stream = await response.Content.ReadAsStreamAsync())
using (StreamReader reader = new StreamReader(stream))
{
var json = JObject.Parse(await reader.ReadToEndAsync());
JArray followers = json.Value<JArray>("followers");
foreach (JObject follower in followers)
{
string id = follower.Value<string>("uid");
if (id.Equals(tikTokUserId)) return true;
}
hasMore = json.Value<bool>("has_more");
maxTime = json.Value<int>("min_time");
}
}
I tried different ways of sending the request, but the result is always the same. I understand if you can't help, and feel free to close the issue if you consider it irrelevant to the project.
Thanks!
Hello friends!
How to get parameter for function UserInfo.initUser?
I can not find either ...
When trying to build with tsc
, you get several errors like so:
error TS2307: Cannot find module '../node_modules/axios/index'
The generated index.d.ts
file for example contains the following axios imports:
loginWithEmail: (email: string, password: string) => Promise<import("../node_modules/axios/index").AxiosResponse<API.LoginResponse>>;
loginWithUsername: (username: string, password: string) => Promise<import("../node_modules/axios/index").AxiosResponse<API.LoginResponse>>;
This is one level off where node_modules
actually is:
- /project_root
|- /node_modules
|- /tiktok-api
|- /lib
- index.d.ts
Therefore in index.d.ts
the path ../node_modules/axios/index
resolves to tiktok-api/node_modules/axios/index
, which is invalid.
This can be fixed by setting baseUrl
to ./lib
in tsconfig.json
please add the Instance methods for
1.Follow to user
2.Unfollow to user
3.Like the post
4.Unlike the post
5.Add commnet to post
6. How can we donate for adding those functions ? :)
What would be needed to download all videos from someones (my) profile? I have over 1,000 and don't feel like downloading each one.. I've been learning python, but the documentation here is fuzzy. Any help is appreciated!
Is your feature request related to a problem? Please describe.
It's difficult for new users to get started quickly because there isn't an example that works out-of-the-box to see and play around with.
Describe the solution you'd like
Add an examples/
folder with some simple examples.
Is your feature request related to a problem? Please describe.
There are a couple more endpoints for which there is no method available yet.
Describe the solution you'd like
'/aweme/v1/music/aweme/' with param music_id
'/aweme/v1/sticker/aweme/' with param sticker_id
They both use cursor instead of max_cursor in requests and responses.
Additional context
Stickers are the video filters/effects.
I haven't looked at these extensively yet, so there might be other differences between listPosts and these.
I use <redacted>
but following does not show up on my profile.
object(stdClass)#250 (5) {
["status_code"]=>
int(0)
["status_msg"]=>
string(25) "Başarıyla takip edildi!"
["log_pb"]=>
object(stdClass)#251 (1) {
["impr_id"]=>
string(32) ""
}
["follow_status"]=>
int(1)
["extra"]=>
object(stdClass)#252 (3) {
["logid"]=>
string(32) ""
["now"]=>
float(1536489137635)
["fatal_item_ids"]=>
array(0) {
}
}
}
Hello!
update X-Tt-Token ?
I am running the app like this:-
node --experimental-modules index.mjs
and this is line is giving error
import TikTokAPI, { getRequestParams } from 'tiktok-api';
error:-
(node:5872) ExperimentalWarning: The ESM module loader is experimental.
TypeError: getRequestParams is not a function
at file:///D:/Node.js/FirstTry/index.mjs:14:16
at ModuleJob.run (internal/loader/ModuleJob.js:97:14)
at <anonymous>
P.S I am new to node.js.
As title states, func getUser(id) fails(response content from server is blank).
Anyone else facing this issue?
export interface AntiSpamParams {
/** A 20-character anti-spam parameter */
as: string;
/** A 20-character anti-spam parameter */
cp: string;
/** An encoded version of the 'as' anti-spam parameter */
mas: string;
}
how do create as and mas?????
Please add the Instance method for get the list of the top users by country.
Hi,
I was wondering if it was possible to supply this API an RTMP stream URL to start a live broadcast? Or if it's a feature you would look to adding?
This Instagram API does it in a similar manner to this one: https://github.com/mgp25/Instagram-API/blob/master/src/Request/Live.php
Thanks
I was able to port this code over to PHP and I made a simple platform using it. TikTok has long and ugly profile URLs. Outside of this wrapper and the actual app there really is no solid way to be able to view a TikTok profile just by knowing the username. With that in mind I put together TikTok2.me which provides users with easy to remember tiktok2.me/username profile links. Users can visit the homepage, enter their username and be provided with a URL or they can just link to tiktok2.me/username and it will function the same.
Describe the bug
Gives an error message: TypeError: axios_cookiejar_support_1.default is not a function
To Reproduce
I just took an example from https://www.npmjs.com/package/tiktok-api/v/0.4.0
Replaced the required data and press run
Hey! @szdc
Can you reach out to me on skype at hacky20091?
I'd like to pay you to help me develop a small web application using this api... I can delete this issue after you contact me.
Thanks,
J
Is your feature request related to a problem? Please describe.
Currently the only way to get a post's data is to get all posts from a user until the desired post is reached.
The API has a way to get a single post if you know its id which can be useful sometimes.
Describe the solution you'd like
The API call is 'aweme/v1/aweme/detail/' with param aweme_id
The result contains the Post in aweme_detail
Additional context
There are some minor differences in the data returned by this call compared to the one used in listPosts(), but nothing important is missing. Can provide examples if needed.
Is your feature request related to a problem? Please describe.
There currently isn't the ability to post new videos/content.
Describe the solution you'd like
An API call we can use to post new videos/content.
Having all the explicit imports has led to imports taking up the first 45+ lines of this file, reducing readability.
Use import * as Network from './types';
or similar to resolve this.
When your account is private, you get notified when someone requests to follow you. Add the endpoint to these requests and the endpoints to approve and deny them.
Hey Jack, amazing job building this. I am not a developer and was interested in having someone build custom scripts that would help me get good usage of this API, is that something you could help with? I could pay you for your time :) if so let me know where I could contact ya!
Can you expand more on this topic? Can you give some kind of example or explain what you want to say with "a method that signs the URL with anti-spam parameters".
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.