An Unofficial TikTok API Wrapper In Python

Overview

Unofficial TikTok API in Python

This is an unofficial api wrapper for TikTok.com in python. With this api you are able to call most trending and fetch specific user information as well as much more.

LinkedIn Sponsor Me GitHub release (latest by date) Build Status GitHub Downloads Support Server

Thank you to our sponsors & advertisers

TikAPI TikAPI is a paid TikTok API service providing an full out-of-the-box solution for developers, trusted by 100+ companies. Learn more

Table of Contents

Getting Started

To get started using this api follow the instructions below.

Installing

If you run into an issue please check the closed issues on the github. You're most likely not the first person to experience this issue. If nothing works feel free to open an issue.

pip install TikTokApi
python -m playwright install

If you would prefer a video walk through of setting up this package I created a YouTube video just for that.

If you're on MacOS you may need to install XCode Developer Tools

Docker Installation

Clone this repository onto a local machine then run the following commands.

docker build . -t tiktokapi:latest
docker run -v TikTokApi --rm tiktokapi:latest python3 your_script.py

Note this assumes your script is named your_script.py and lives in the root of this directory.

Common Issues

Please don't open an issue if you're experiencing one of these just comment if the provided solution do not work for you.

Quick Start Guide

Here's a quick bit of code to get the most recent trending on TikTok. There's more examples in the examples directory.

from TikTokApi import TikTokApi
api = TikTokApi.get_instance()
# If playwright doesn't work for you try to use selenium
# api = TikTokApi.get_instance(use_selenium=True)

results = 10

# Since TikTok changed their API you need to use the custom_verifyFp option. 
# In your web browser you will need to go to TikTok, Log in and get the s_v_web_id value.
trending = api.trending(count=results, custom_verifyFp="")

for tiktok in trending:
    # Prints the id of the tiktok
    print(tiktok['id'])

print(len(trending))

To run the example scripts from the repository root, make sure you use the module form of python the interpreter

python -m examples.getTrending

Here's an example of what a tiktok dictionary looks like.

Documentation

You can find the documentation here (you'll likely just need the TikTokApi section of the docs), I will be making this documentation more complete overtime as it's not super great right now, but better than just having it in the readme!

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Comments
  • [BUG] - 'browser' object has no attribute 'verifyFp'

    [BUG] - 'browser' object has no attribute 'verifyFp'

    When running the example code from the README:

    from TikTokApi import TikTokApi api = TikTokApi()

    results = 10

    trending = api.trending(count=results)

    for tiktok in trending: # Prints the text of the tiktok print(tiktok['desc'])

    print(len(trending))

    I recieve the below error:

    AttributeError: 'browser' object has no attribute 'verifyFp'

    I installed chromedriver, but may not have added it to the right path. Can you give guidance in this regards?

    bug 
    opened by demalem 41
  • Status 200 is always thrown

    Status 200 is always thrown

    Currently when I run the trending function, it never returns a status 0. I believe that the signature found via selenium is not a totally valid one, and if you go to the tiktok trending website with a headed browser you can see the videos never really load

    bug 
    opened by tmichel124 38
  • [BUG] - TikTok blocks this request displaying a Captcha

    [BUG] - TikTok blocks this request displaying a Captcha

    Description of the bug Systematic captcha error when using by_username method. Error message advises using proxy or a custom_verifyFp but this bug would also appear after a while in previous versions for which I had tried using proxy or a custom_verifyFp without success until a new version eventually fixed this issue. And this has happened quite a few times actually so I suppose you might know how to fix it again now. When you do, I'd be glad if you could explain how you did it, so I can fix it myself in the future and upload pull request quickly since I use your API on a daily basis.

    The buggy code

    from TikTokApi import TikTokApi as t
    api = t.get_instance()
    k = api.by_username("")
    

    Error Trace

    ERROR:root:Tiktok wants to display a catcha. Response is:
    {"code":"10000","from":"","type":"verify","version":"","region":"va","subtype":"slide","detail":"GDIqyl9SLA5lVSsn4JVxPJ2cYRgDuhDP2NBDA0FqMagtMGQB8TGV2kpodkbZzjHKYcgIzsCRQbF60HRg3l9Qauc2Do6mMa-0Zg5zDKWegm2X6nPmvd0*iT3sZKcm1jeSXuYDR8MliQ8C-w5slo0ucQ-I1mouIfpZAPBvtuqCaLlitjnBe-x9821RxB7KI1poAlO19vIyMqX4daxORf7eHrqKoJv7CA03WhiLzQT0*0mhfkO1deNBCczMZ6SIL6hTp6aUbCoqz51dHuiKM-cGG*WHzU*snEBYxNaixbl84PVCwRqDYF1byBZiBDJ8jU50uDiiJ53EL3dtYdXtcoWBr6Q8F1Cly-FTFBOuwusDQEbR*bKMA23oExlFHGvq2mAlpYmzG*v-6mvF64wPNe1i1xh-qHQPS3zWJxo.","verify_event":"","fp":"verify_khr3jabg_V7ucdslq_Vrw9_4KPb_AJ1b_Ks706M8zIJTq","scene":"","verify_ticket":"","channel_mobile":"","sms_content":"","mobile":"","email":""}
    ERROR:root:{'tt_webid': '1637611630395385016', 'tt_webid_v2': '1637611630395385016', 'csrf_session_id': '13d94c933ff245fd8bf4696164422b16', 'tt_csrf_token': 'vAtEBuHpdiZmCVUk'}
    Traceback (most recent call last):
      File "C:\Users\me\Documents\0_Projet\herer\testt\bug.py", line 4, in <module>
        k = api.by_username(us)
      File "C:\Users\me\AppData\Roaming\Python\Python37\site-packages\TikTokApi\tiktok.py", line 603, in by_username
        **kwargs,
      File "C:\Users\me\AppData\Roaming\Python\Python37\site-packages\TikTokApi\tiktok.py", line 563, in user_posts
        res = self.get_data(url=api_url, **kwargs)
      File "C:\Users\me\AppData\Roaming\Python\Python37\site-packages\TikTokApi\tiktok.py", line 279, in get_data
        raise TikTokCaptchaError()
    TikTokApi.exceptions.TikTokCaptchaError: TikTok blocks this request displaying a Captcha 
    Tip: Consider using a proxy or a custom_verifyFp as method parameters
    

    Desktop

    • OS: Windows 10
    • TikTokApi Version : 3.9.9
    bug 
    opened by Alex-Laparra 37
  • [BUG] - Video playAddr/downloadAddr video URL invalid

    [BUG] - Video playAddr/downloadAddr video URL invalid

    I am not able to access the video url in playAddr or downloadAdd by using the requests package.

    Example playAddr/downloadAddr: url = https://v16-web-newkey.tiktokcdn.com/72bd098ebfeaa71c084919d3a55efd64/5f93f32e/video/tos/useast2a/tos-useast2a-ve-0068c003/6e2d74eb3de944a28013313625663e6f/?a=1988&br=5980&bt=2990&cr=0&cs=0&cv=1&dr=0&ds=3&er=&l=2020102403255301019020801232109270&lr=tiktok_m&mime_type=video_mp4&qs=0&rc=M3lzajV1czVodzMzaDczM0ApaDNkODs0ZTxkNzdlOzhkOmdhYi4tcDVkZTFfLS0xMTZzc2NfX18tYWIxMDFgMS1gXi86Yw%3D%3D&vl=&vr=

    When trying to access: video_bytes = requests.get(url, headers={"User-Agent": "okhttp"}).content I get response: b'<HTML><HEAD>\n<TITLE>Access Denied</TITLE>\n</HEAD><BODY>\n<H1>Access Denied</H1>\n \nYou don\'t have permission to access "http&#58;&#47;&#47;v16&#45;web&#45;newkey&#46;tiktokcdn&#46;com&#47;72bd098ebfeaa71c084919d3a55efd64&#47;5f93f32e&#47;video&#47;tos&#47;useast2a&#47;tos&#45;useast2a&#45;ve&#45;0068c003&#47;6e2d74eb3de944a28013313625663e6f&#47;&#63;" on this server.<P>\nReference&#32;&#35;18&#46;bfa83617&#46;1603510554&#46;9d99b4\n</BODY>\n</HTML>\n'

    Versioning:

    • Google Colab
    • TikTokApi Version 3.5.5 (3.5.6 was giving some weird errors about DevTools listening on ws://127.0.0.1:49147/devtools/browser/9a11fbf1-4032-42c0-95f3-5c22a8356070 [1024/035014.316372:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory so I used the prev version)
    bug help wanted Hacktoberfest 
    opened by michellebao 24
  • [BUG] - TikTokApi.exceptions.TikTokCaptchaError: TikTok blocks this request displaying a Captcha

    [BUG] - TikTokApi.exceptions.TikTokCaptchaError: TikTok blocks this request displaying a Captcha

    Describe the bug

    I am trying to scrape posts from profile using your code, but getting 10000 error code. I did a bit of debugging and found out that the issue is maybe due to invalid _signature. I have already tried with custom_verifyFp and also proxy as well as VPN but facing the same error.Also, I am able to open the profile in browser without loging, so my IP isn't blocked and it isn't displaying any captcha.

    The buggy code

    from TikTokApi import TikTokApi
    api = TikTokApi.get_instance()
    results = 10
    
    # Since TikTok changed their API you need to use the custom_verifyFp option.
    # In your web browser you will need to go to TikTok, Log in and get the s_v_web_id value.
    trending = api.by_trending(count=results, custom_verifyFp="")
    
    for tiktok in trending:
        # Prints the id of the tiktok
        print(tiktok['id'])
    
    print(len(trending))
    

    Error Trace (if any)

    {'code': '10000', 'from': '', 'type': 'verify', 'version': '', 'region': 'va', 'subtype': 'slide', 'detail': 'Om4r-6OL8ecuWLMH8SchRcSS*vOeX31LKaHuFj5Peq9G0Xs6exPK3AvgF4YYrtxCmogpSWm77DlG2fI-cWlFiLmJslx131cJwD2PyDCDPGdpK4spDr*yIGkjnisc*NUc-tCvThVSlL4bbWdo*iD9Kr7zUb8RHkIq*iSpfvTNMvliuLSjFDp17FDnrJ-jWT9uiXSYTg5Gg1-VUmEU1O14CvK66X6wBIH9LvN-l2fbmRalRMnFTz9O5lR7*BCOXSkRqf3ayX-N222kiUfR3hDgHC70tocZUsPmS1vb4lnVw8qUsvPy2jf2oFLeelwW1x4N6q49EDJAelLbcznZeq0kZ3LpXHkxUlYLOLghRxlIwGlXC5oM3r5FdvRGvz-VAt0w242xhX-DyWL*nFmpO*7C*MMeMb0HiKDB', 'verify_event': '', 'fp': 'verify_3367e439432b62d07dc6348cfd4068e7', 'scene': '', 'verify_ticket': '', 'channel_mobile': '', 'sms_content': '', 'mobile': '', 'email': ''}
    

    Desktop (please complete the following information):

    • OS: Windows 11
    • TikTokApi Version [e.g. 3.3.1] - 4.1.0

    Additional context

    Add any other context about the problem here.

    bug 
    opened by kevit-dhairya-bapodra 23
  • [BUG] - api.get_Video_No_Watermark is not working

    [BUG] - api.get_Video_No_Watermark is not working

    Describe the bug

    I haven't used this api for a while, after update latest version i cant use api.get_Video_No_Watermark. it only download 81 bytes video, sometimes returning NoneType

    bug 
    opened by RVLVT 23
  • [BUG] - KeyError: 'hasMore'

    [BUG] - KeyError: 'hasMore'

    trying to download a video using code

    https://github.com/davidteather/TikTok-Api/issues/311#issuecomment-721164493

    just want to download video (get bytes)

    File "C:\Users\USER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\TikTokApi\tiktok.py", line 406, in userPosts
        if not res["hasMore"] and not first:
    KeyError: 'hasMore'
    
    • OS: Windows 10
    • TikTokApi Version 3.7.9
    bug 
    opened by rnyPlanet 22
  • [BUG] - custom_verifyFp is useless because s_v_web_id does not exist any more in cookies.

    [BUG] - custom_verifyFp is useless because s_v_web_id does not exist any more in cookies.

    It seems to be that TikTok had changed auth system because s_v_web_id cookie does not exist any more. Also, User cookie has changed - take a look into document.cookie in Dev tools in browser - its brand new structure.

    So, API does not work for deep analysis, because it requires auth on TikTok. All our cron stuff and robots need to be checked - here is no data.

    Help with this auth isses will be very appreciated.

    bug 
    opened by mjblski 21
  • After first success .TikTok blocks this request displaying a Captcha .

    After first success .TikTok blocks this request displaying a Captcha .

    I just updated to the newest version and followed the first example to check if it works.

    It works..but only once...is there any advice?

    thank you.

    code:

    from TikTokApi import TikTokApi results = 10 api = TikTokApi.get_instance() verifyFp = 'verify_xxxxxxxxxxx' proxy_address = 'http://127.0.0.1:1111' trending = api.trending(count=results, custom_verifyFp=verifyFp, proxy=proxy_address) for tiktok in trending: print(tiktok['id'])

    I got this response immediately after first success.

    TikTokApi.exceptions.TikTokCaptchaError: TikTok blocks this request displaying a Captcha Tip: Consider using a proxy or a custom_verifyFp as method parameters

    opened by LSSCP 21
  • `TikTok blocks this request displaying a Captcha` even with `custom_verifyFp` and `proxy`

    `TikTok blocks this request displaying a Captcha` even with `custom_verifyFp` and `proxy`

    Everything was fine until last few days.

    from TikTokApi import TikTokApi
    import json
    import logging
    tiktok_api = TikTokApi.get_instance(request_delay=1)
    
    tiktoks = tiktok_api.by_username('japanontiktok', count=1, custom_verifyFp="...", proxy='http://...', use_test_endpoints=True)
    
    for tiktok in tiktoks[:1]:
        print(json.dumps(tiktok))
    

    Error:

    Traceback (most recent call last):
      File "/usr/local/lib/python3.8/dist-packages/TikTokApi/tiktok.py", line 1333, in get_user
        j_raw = self.__extract_tag_contents(r.text)
      File "/usr/local/lib/python3.8/dist-packages/TikTokApi/tiktok.py", line 1553, in __extract_tag_contents
        nonce = html.split(nonce_start)[1].split(nonce_end)[0]
    IndexError: list index out of range
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "tests.py", line 220, in <module>
        tiktoks = tiktok_api.by_username('japanontiktok', count=1, custom_verifyFp="...", proxy='http://...', use_test_endpoints=True)
      File "/usr/local/lib/python3.8/dist-packages/TikTokApi/tiktok.py", line 700, in by_username
        data = self.get_user_object(username, **kwargs)
      File "/usr/local/lib/python3.8/dist-packages/TikTokApi/tiktok.py", line 1301, in get_user_object
        return self.get_user(username, **kwargs)["userInfo"]["user"]
      File "/usr/local/lib/python3.8/dist-packages/TikTokApi/tiktok.py", line 1339, in get_user
        raise TikTokCaptchaError()
    TikTokApi.exceptions.TikTokCaptchaError: TikTok blocks this request displaying a Captcha 
    Tip: Consider using a proxy or a custom_verifyFp as method parameters
    

    The most interesting thing there is that I can partly see obtained data from TikTok because its print HTML page in console before the error. You can see full response here: https://gist.githubusercontent.com/kostyakoz/1d5a7339217d646f1556d9fd63bcf7a8/raw/b18f4ae5e869325bb746c48fae102c8786b43fdb/error.py

    My question is why obtained data not returned and I have only error?

    bug 
    opened by kostyakoz 19
  • ERROR: The request could not be satisfied

    ERROR: The request could not be satisfied

    The TikTok API isn't working, ERROR:root:Tiktok response:

    ERROR: The request could not be satisfied

    403 ERROR

    The request could not be satisfied.


    Bad request. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
    If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.

    Generated by cloudfront (CloudFront)
    Request ID: YDg97PShlKvMCvORQQRIBUZ6DGm5DhyGtMNTZvQ3_q2yRs___8dpLA==
    
    bug 
    opened by zurdok1280 19
  • [FEATURE_REQUEST] - How can I play a video to make a view?

    [FEATURE_REQUEST] - How can I play a video to make a view?

    from TikTokApi import TikTokApi

    api = TikTokApi()

    video = api.video(id = '7177652750682033413')

    And now i want some like video.play() to play the video and count a video.

    feature_request 
    opened by xPaulFTW 0
  • Is there a way to use the api,video to download the videos?

    Is there a way to use the api,video to download the videos?

    I was going through the documentation and examples, and while messing around and trying out the examples, I seem to get errors regarding kwargs. If anyone can steer me in the right direction for a script like this let me know!

    installation_help 
    opened by fungjk4 1
  • KeyError:

    KeyError: "name='ttwid', domain=None, path=None"

    Hi i try am may ways to slove the problem .

    • on windows 10 and ubtuntu with pyhton versions 3.11 and 3.10 and 3.9
    • and this solution by @adamd01 👍🏼 : https://github.com/davidteather/TikTok-Api/issues/891#issuecomment-1148930488

    File "/home/me/Tk/main.py", line 29, in <module> for trending_video in api.trending.videos(count=5): File "/home/me/Tk/env/lib/python3.11/site-packages/TikTokApi/api/trending.py", line 40, in videos ttwid = spawn.cookies["ttwid"] ~~~~~~~~~~~~~^^^^^^^^^ File "/home/devy/Tk/env/lib/python3.11/site-packages/requests/cookies.py", line 334, in __getitem__ return self._find_no_duplicates(name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/me/Tk/env/lib/python3.11/site-packages/requests/cookies.py", line 413, in _find_no_duplicates raise KeyError(f"name={name!r}, domain={domain!r}, path={path!r}") KeyError: "name='ttwid', domain=None, path=None"

    bug 
    opened by souffyan 10
  • [BUG] - CaptchaException even with proxy and custom_verify_fp

    [BUG] - CaptchaException even with proxy and custom_verify_fp

    Fill Out the template :)

    Getting captcha exception no matter what I do, even with custom_verify_fp and residential proxy

    A clear and concise description of what the bug is.

    from TikTokApi import TikTokApi
    proxy = "http:my_proxy:port"
    sv = "verify_lb1f1ug1_u3VZLU0Y_u56b_4liW_ASSF_2qSvrqrdJjTZ"
    api = TikTokApi(proxy=proxy, custom_verify_fp=sv)
    user = api,user(username="any_user")
    user.as_dict
    
    Exception:
    CaptchaException: 0 -> TikTok blocks this request displaying a Captcha
    Tip: Consider using a proxy or a custom_verify_fp as method parameters
    ``
    
    **Desktop (please complete the following information):**
     - OS: Arch Linux
     - TikTokApi Version [e.g. 5.0.0] - latest version (did pip install --upgrade)
    
    bug 
    opened by gbiz123 2
  • [BUG] - Telegram Bot Error usin TikTokApi 5.2.2

    [BUG] - Telegram Bot Error usin TikTokApi 5.2.2

    Describe the bug

    I tried to make a Telegram bot for myself that would convert video links from tiktok into video itself so I wouldn't have to quit it every time (I know they already exist, but I wanted to try to make something like that myself). The idea was that the bot would receive the link and using TikTokApi I would create a video and send it through the bot to the user, but when trying to do such a thing, there was such an error, moreover, the same error occurred when I tried to create code for conversion in a separate API (Flask and Django), hoping that at least from it I will be able to access the video data, but even so it was not able to do, as far as I understood the error is associated with asyncio, but, unfortunately, about asynchrony and the library itself I do not know enough to fix the problem myself, please help!

    The buggy code

    from telebot import TeleBot
    from TikTokApi import TikTokApi
    
    bot = TeleBot("TOKEN")
    api = TikTokApi(logging_level=logging.INFO)
    
    
    @bot.message_handler()
    def get_user_text(message):
        if message.text.startswith("https://vm.tiktok.com/"):
            req_video = api.video(url=message.text)
            print(req_video.bytes())
    
    
    bot.polling()
    
    
    

    Expected behavior

    In this example it was supposed to send the video data that I would later work with to create the video itself and send through the bot, but already at this point there are problems

    Error Trace

    Traceback (most recent call last):
      File "C:\Users\Admin\PycharmProjects\TelegramBot\main.py", line 16, in <module>
        bot.polling()
      File "C:\Users\Admin\PycharmProjects\TelegramBot\venv\lib\site-packages\telebot\__init__.py", line 1047, in polling
        self.__threaded_polling(non_stop=non_stop, interval=interval, timeout=timeout, long_polling_timeout=long_polling_timeout,
      File "C:\Users\Admin\PycharmProjects\TelegramBot\venv\lib\site-packages\telebot\__init__.py", line 1122, in __threaded_polling
        raise e
      File "C:\Users\Admin\PycharmProjects\TelegramBot\venv\lib\site-packages\telebot\__init__.py", line 1078, in __threaded_polling
        self.worker_pool.raise_exceptions()
      File "C:\Users\Admin\PycharmProjects\TelegramBot\venv\lib\site-packages\telebot\util.py", line 154, in raise_exceptions
        raise self.exception_info
      File "C:\Users\Admin\PycharmProjects\TelegramBot\venv\lib\site-packages\telebot\util.py", line 98, in run
        task(*args, **kwargs)
      File "C:\Users\Admin\PycharmProjects\TelegramBot\venv\lib\site-packages\telebot\__init__.py", line 6086, in _run_middlewares_and_handler
        result = handler['function'](message)
      File "C:\Users\Admin\PycharmProjects\TelegramBot\main.py", line 13, in get_user_text
        print(req_video.bytes())
      File "C:\Users\Admin\PycharmProjects\TelegramBot\venv\lib\site-packages\TikTokApi\api\video.py", line 113, in bytes
        video_data = self.info(**kwargs)
      File "C:\Users\Admin\PycharmProjects\TelegramBot\venv\lib\site-packages\TikTokApi\api\video.py", line 74, in info
        return self.info_full(**kwargs)["itemInfo"]["itemStruct"]
      File "C:\Users\Admin\PycharmProjects\TelegramBot\venv\lib\site-packages\TikTokApi\api\video.py", line 95, in info_full
        return self.parent.get_data(path, **kwargs)
      File "C:\Users\Admin\PycharmProjects\TelegramBot\venv\lib\site-packages\TikTokApi\tiktok.py", line 266, in get_data
        ) = asyncio.get_event_loop().run_until_complete(
      File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 656, in get_event_loop
        raise RuntimeError('There is no current event loop in thread %r.'
    RuntimeError: There is no current event loop in thread 'WorkerThread2'.
    
    Process finished with exit code 1
    

    Desktop:

    • OS: Windows 10
    • TikTokApi Version: 5.2.2
    bug 
    opened by YuraBeseda 0
Releases(V5.2.2)
  • V5.2.2(Jul 15, 2022)

  • V5.2.0(Jul 3, 2022)

    Additions

    • Comments are now available on Videos

    TODO

    User info route is exposed, although it uses msToken heavily and not sure how to work around that at the moment

    Tests passing and tests still failing

    tests/test_comments.py::test_comment_page PASSED
    tests/test_comments.py::test_comment_paging PASSED
    tests/test_hashtag.py::test_hashtag_videos PASSED
    tests/test_hashtag.py::test_hashtag_info PASSED
    tests/test_hashtag.py::test_non_latin1 PASSED
    tests/test_integration.py::test_video_attributes PASSED
    tests/test_sound.py::test_sound_videos PASSED
    tests/test_sound.py::test_sound_info PASSED
    tests/test_video.py::test_video_id_from_url PASSED
    tests/test_video.py::test_video_info PASSED
    tests/test_video.py::test_video_bytes PASSED
    
    tests/test_search.py::test_video FAILED
    tests/test_search.py::test_users FAILED
    tests/test_trending.py::test_trending_videos FAILED
    tests/test_user.py::test_user_info FAILED
    tests/test_user.py::test_user_videos FAILED
    tests/test_user.py::test_user_liked FAILED
    
    Source code(tar.gz)
    Source code(zip)
  • V5.1.1(Mar 21, 2022)

  • V5.1.0(Mar 20, 2022)

    New Suggested Usage

    with TikTokApi() as api:
        pass
    

    Although old way of TikTokApi() works as well.

    Exceptions

    • Now all derived from TikTokException
    • Some naming changes

    Jupyter Support

    Improved Models

    • Throws an error if a sound has been removed
    • Video has a create_time & stats attribute (should probably add stats field to other models)

    Current Problems

    • Hashtag.videos
    • Trending.videos
    • User.videos
    • All seem to be related to new TikTok changes I made #861 to discuss

    pytest output

    tests\test_hashtag.py F..
    tests\test_integration.py F
    tests\test_search.py ..
    tests\test_sound.py ..
    tests\test_trending.py F
    tests\test_user.py .F.
    tests\test_video.py ...
    
    Source code(tar.gz)
    Source code(zip)
  • V5.0.0(Feb 14, 2022)

    IMPORTANT CHANGES

    • Please read the upgrading from V4 to V5 section on the readme
      • Higher level approach using objects
      • Auto-parsing of attributes and responses back into objects
      • Should be easier to work with (especially for new-comers not as familiar with this package)
    • dropped support for selenium (sorry but it's been too annoying to main multiple browsers)

    Main PR

    If this broke your code please pin your dependency versions

    V5 Example Usage

    from TikTokApi import TikTokApi
    
    verify_fp = "verify_xxx"
    api = TikTokApi(custom_verify_fp=verify_fp)
    
    tag = api.hashtag(name="funny")
    print(tag.info())
    
    for video in tag.videos():
        print(video.id)
        for u_vid in video.author.videos():
            print(u_vid.id)
    
    Source code(tar.gz)
    Source code(zip)
  • V4.1.0(Dec 11, 2021)

    All tests currently passing

    Upgrade with pip install TikTokApi --upgrade

    REMOVED

    • discover_hashtags,discover_music (can be replicated with the "search_for" methods giving it an empty string as query)
    • get_suggested & crawlers methods (think the endpoint is only available for desktop and the package uses IOS)

    All Changes

    • Removed useless node dependency in tests
    • update get_trending.py to reflect new naming change
    • allow for mobile shortened URLs
    • add unit description on request_delay
    • removed host&authority to bypass 403 error
    • fix by_trending
    • added more tiktok exception message logging

    Feel free to connect on LinkedIn, I'd love to hear about how you're using the package! Feel free to sponsor me on GitHub it helps me maintain this :)

    Thank you for using this package, David

    Source code(tar.gz)
    Source code(zip)
  • V4.0.4.2(Dec 2, 2021)

  • V4.0.4.1(Dec 2, 2021)

  • V4.0.4(Sep 23, 2021)

  • V4.0.3(Sep 22, 2021)

    Hey here's a brief summary of this release I am too tired to write a longer one

    • Update Selenium to work with the changed code (but please try to switch to playwright if you can it's a pain to support both)
    • Add by_sound_page similar to user_page
    • When going to the tiktok site directly unneeded content like .mp4 and images are not loaded

    That's all :) Thank you for using this API

    Source code(tar.gz)
    Source code(zip)
  • V4.0.2(Sep 21, 2021)

    It appears that most of the methods have been fixed :). Big shout out to @MuffinFox for #699 and to @carcabot who found the new updated signature methods (and for the code I've used in the past). Thanks to everyone who helped on #695

    Finally, if you're reading this thank you for supporting this API.

    Update with pip install TikTokApi --upgrade

    Kinda Broken :\

    • by_trending -> only retrieves the first page of trending which TikTok then responds hasMore: False which makes the code exit. Not sure how to get around this right now

    Intermittent Issues

    • by_hashtag -> sometimes throws error saying it doesn't exist

    Methods Still Not Currently Working

    • get_suggested_users_by_id / get_suggested_hashtags_by_id / get_suggested_music_by_id
    • discover_hashtags / discover_music
    Source code(tar.gz)
    Source code(zip)
  • V4.0.1(Aug 7, 2021)

    • Fixed TikTokApi has no attribute .region
    • Changed up tests to hopefully have CI pass more
    • Add README to the doc generator
    pip install TikTokApi --upgrade
    

    I'm just a student who would love new connections :) LinkedIn Feel free to sponsor me on GitHub it helps me maintain this :)

    Source code(tar.gz)
    Source code(zip)
  • V4.0.0(Aug 4, 2021)

    • Fix downloading tiktoks
    • Fully deprecate old naming convention
    • Convert did to device_id to be consistent with current state of the website
    • Avoid detection further by comparing headers to my iOS device's

    Run

    pip install TikTokApi --upgrade
    

    How to update from V3 to V4

    1. Replace all camel case functions with snake case) Ex: getUserObject -> get_user_object
    2. Change custom_did to custom_device_id This change better reflects what's going on in the frontend.
    3. Change trending -> by_trending

    Sorry for kinda neglecting this repository, hope you enjoy these changes. All tests passed at least once across the different testing VMs, I really gotta find a better way to test this, let me know if you know of a better way thanks :)

    I'm just a student who would love new connections :) LinkedIn Feel free to sponsor me on GitHub it helps me maintain this :)

    I feel like I'm adding too many :) but maybe that's a result of me being up at 1am 😄

    Source code(tar.gz)
    Source code(zip)
  • V3.9.9.1(Jun 27, 2021)

  • V3.9.9(Jun 10, 2021)

    Thanks for the PR #613 all tests passed on it (which they haven't done on GitHub actions for quite some time) thanks to #613 as of right now.

    If they're passing this convincingly on GitHub actions scraping should be more efficient and less detectable for now.

    Feel free to connect with me on LinkedIn

    Feel free to sponsor me on GitHub.

    Thanks :)

    Source code(tar.gz)
    Source code(zip)
  • V3.9.7(Jun 2, 2021)

    Seems like the discover methods are no longer working as frequently if at all with the use_test_endpoints=True, look at the diff for this pr (#603 ) specifically in the test files to see the methods that seem to be affected the most.

    Also generate_did has been moved to a static function.

    Feel free to connect with me on LinkedIn

    (also the tests are passing on my machine just not GitHub actions because they're not on residential IPs some of the errors might be transient)

    Source code(tar.gz)
    Source code(zip)
  • V3.9.6(May 13, 2021)

    Merged

    • #577
    • #578
    • #580

    See #586 for methods that currently aren't working

    I've also joined the brave browser rewards so if you want to feel free to tip me if you use brave browser using your BAT

    Source code(tar.gz)
    Source code(zip)
  • V3.9.5(Apr 1, 2021)

  • V3.9.4(Mar 20, 2021)

    Changes

    • Updated documentation for custom_did
    • custom_did is maintained at the instance level if set
    • generate_static_did added as a parameter to the TikTok constructor. If set to True it will generate and maintain a static custom_did so you don't have to do it yourself.
    • Added generate_did method which returns a valid did which you can use however you want.

    Sponsor me on GitHub Connect with me on LinkedIn

    Source code(tar.gz)
    Source code(zip)
  • V3.9.3(Mar 15, 2021)

    This package has spent too long having its documentation listed in the readme of all places. I'm excited to announce that I've added a new auto-documenting part to the codebase. Hopefully, that makes this package that much more easy to deal with

    Naming Scheme

    • All the methods have moved from camelCase to snake_case as it's annoyed me for a bit
    • BUT don't worry it's backward compatible and I intend to keep it that way for at least awhile

    The last time I did this it was super effective so please connect with me on LinkedIn if you're reading this. I'm just a 1st year in college and anything helps, plus I spent like 3.5 hours on this update on a Sunday night.

    Source code(tar.gz)
    Source code(zip)
  • V3.9.2(Mar 8, 2021)

    Changes

    • TikTok updated their endpoints and some JSON that it returned
    • Some maxCursor and minCursor have been deprecated due to it being changed on TikTok's end, so you may need to change these to restore functionality

    If you're reading this you really should connect with me on LinkedIn I'm just a student who needs more connections. Also feel free to sponsor me

    Source code(tar.gz)
    Source code(zip)
  • V3.9.1(Feb 25, 2021)

  • V3.9.0(Feb 15, 2021)

  • V3.8.9(Dec 28, 2020)

    The main update is the fix of the no watermark method.

    The naming scheme for that method has changed it is now get_video_no_watermark(self, video_url, return_bytes=1, **kwargs)

    The other change is the introduction of get_tiktok_by_html(self, url, **kwargs) this was added a helper method of get_video_no_watermark but it extracts the information from the HTML of a TikTok rather than API calls

    To download a video here's example code

    from TikTokApi import TikTokApi
    
    api = TikTokApi.get_instance(use_test_endpoints=True)
    
    data = api.get_video_no_watermark('https://www.tiktok.com/@gordonramsayofficial/video/6910298199769009414?lang=en')
    
    with open("test.mp4", "wb") as out:
        out.write(data)
    
    Source code(tar.gz)
    Source code(zip)
  • V3.8.8(Dec 24, 2020)

  • V3.8.7(Dec 23, 2020)

  • V3.8.6(Dec 10, 2020)

Owner
David Teather
A Computer Science Student.
David Teather
A Powerful, Smart And Advance Group Manager ... Written with AioGram , Pyrogram and Telethon...

❤️ Shadow ❤️ A Powerful, Smart And Advance Group Manager ... Written with AioGram , Pyrogram and Telethon... ⭐️ Thanks to everyone who starred Shadow,

TeamShadow 17 Oct 21, 2022
A simple API wrapper for Discord written in Python.

AIOCord This project is work in progress not for production use A simple asynchronous API wrapper around Discord API written in Python. Inspiration Th

Izhar Ahmad 3 Dec 07, 2021
Python wrapper for the Sportradar APIs ⚽️🏈

Sportradar APIs This is a Python wrapper for the sports APIs provided by Sportradar. You'll need to sign up for an API key to use the service. Sportra

John W. Miller 39 Jan 01, 2023
Telegram vc userbot

Telegram Vc Userbot Available Commands /ping :- To check whether userbot is up or not /joinvc :- To join vc /leavevc :- To leave vc /join_group :- To

NandyDark 7 Nov 18, 2022
Twitter FakeNFT With Python

This project is a server that fetches your Twitter profile picture and applies the hexagonal transparency mask displayed on the profiles of users who have an NFT profile picture.

Mathis HAMMEL 29 Apr 23, 2022
A discord bot that moderates your server!

Staff Bot para Discord O que é? É um bot que modera o seu servidor no Discord, apagando mensagens indesejadas que os usuários mandem! Como usar Primei

Isac Gonçalves Cunha 3 Oct 07, 2021
A Python Instagram Scraper for Downloading Profile's Posts, stories, ProfilePic and See the Details of Particular Instagram Profile.

✔ ✔ InstAstra ⚡ ⚡ ⁜ Description ~ A Python Instagram Scraper for Downloading Profile's Posts, stories, ProfilePic and See the Details of Particular In

12 Jun 23, 2022
A python oriented telegram with API of yobit.net

YoBit-BTC A python oriented telegram bot with API of https://yobit.net/ Developed By @riz4d What is Yobit? ➪ YoBit is a cryptocurrency exchange that w

Muhammed Rizad 6 Apr 02, 2022
A simple notebook to stream torrent files directly to Google Drive using Google Colab.

Colab-Torrent-to-Drive Originally by FKLC, this is a simple notebook to stream torrent files directly to Google Drive using Google Colab. You can eith

1 Jan 11, 2022
A Discord bot for viewing any currency you want comfortably.

Dost Dost is a Discord bot for viewing currencies. Getting Started These instructions will get you a copy of the project up and running on your local

Baran Gökalp 2 Jan 18, 2022
Many discord bots serving different purposes

Discord_Botlari Farklı amaçlara hizmet eden bir çok discord botu En kapsamlı Bot Game Bottur. bir oyun botudur discord sunucularında kullanılır. (tüm

1 Dec 21, 2021
Catware - A powerful grabber with a built in bot control system

catware A powerful grabber with a built in bot control system PLEASE NOTE THAT I

4 Feb 04, 2022
Dribble sign up screen built in python and kivy

Dribble sign up screen built in python and kivy contains Dribble icon with icon position and shadow animation.

1 Dec 06, 2021
Python bot for send videos of a Youtube channel to a telegram group , channel or chat

py_youtube_to_telegram Usage: If you want to install ytt and use it, run this command: sudo sh -c "$(curl -fsSL https://raw.githubusercontent.com/nima

Nima Fanniasl 8 Nov 22, 2022
AWS SQS event redrive Lambda

This repository contains the Lambda function to redrive sqs events from source to destination queue while controlling maxRetry per event.

1 Oct 19, 2021
An advanced Filter Bot with nearly unlimitted filters

Telegram MTProto API Framework for Python Documentation • Releases • Community Pyrogram from pyrogram import Client, filters app = Client("my_account

Pyrogram 3.2k Jan 05, 2023
Auto-commiter - Auto commiter Github

auto committer Github Follow the steps below to use this repository: 1-install c

Arman Ebtekari 8 Nov 14, 2022
Discord Bot for League of Legends live match tracker

SABot Dicord Bot for League of Legends match auto tracker Features: Search Summoners statistics in League of Legends. Auto-notifications provide when

Jungyu Choi 4 Sep 27, 2022
A Next-Gen modular Python3 Telegram-Bot with Anime Theme to it.

Hsea Robot A modular Telegram Python bot running on python3 with a sqlalchemy database and an entirely themed persona to make Cutiepii suitable for An

Wahyusaputra 1 Dec 29, 2021
Smilecreator4 - This site is for people who want to hack or want to learn it!

smilecreator4 This site is for people who want to hack or want to learn it! Furthermore, this program does not work without turning off Antivirus or W

1 Jan 04, 2022