Coder Social home page Coder Social logo

davidteather / tiktokbot Goto Github PK

View Code? Open in Web Editor NEW
342.0 14.0 60.0 150.9 MB

A TikTokBot that downloads trending tiktok videos and compiles them using FFmpeg

License: Other

Python 100.00%
tiktok ffmpeg video editing webscraping tik tok api unoffical tiktok-api

tiktokbot's Introduction

TikTok Video Bot

Consider sponoring me here

This project downloads the trending tiktok videos and compiles them into a video.

NOTE: VERY OUT OF DATE if you want submit a PR to update the code using TikTokApi's new versions

NOTE This project will most likely be behind my TikTok-API. Adapt that to use FFMpeg if you want a better experience TikTok-API. I will still update this just it will most likely be a few updates behind that other repo.

Getting Started

These instructions will get you a copy of the project up and running on your local machine.

Installing and Prerequisites

You need to have ffmpeg installed and in your path variable, tutorial here.

You will also have to follow the instructions here for installing the unofficial tiktok-api

Python Requirements

pip install TikTokApi

or you can do

pip install -r requirements.txt

Running the bot

It's really simple, go to the directory and execute the following command

python tiktokbot.py

Built With

Authors

tiktokbot's People

Contributors

davidteather avatar theclio69 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tiktokbot's Issues

ERROR ValueError: could not convert string to float: ''

Traceback (most recent call last):
File "E:\TikTokBot-master\tiktokbot.py", line 156, in
vidLength = getLength('downloaded/' + str(x) + ".mp4")
File "E:\TikTokBot-master\tiktokbot.py", line 23, in getLength
secs = float(secsval)
ValueError: could not convert string to float: ''

Traceback (most recent call last)

Pick a video length (1-3)

  1. 2-3 minutes
  2. 5-7 minutes
  3. 10-12 minutes
    1
    Select a video type
  4. Trending
  5. Hashtag
  6. User
  7. Sound
    1
    Traceback (most recent call last):
    File "tiktokbot.py", line 114, in
    verifyFp = "verify_" + ''.join(random.choice(string.letters) for num in range(40))
    File "tiktokbot.py", line 114, in
    verifyFp = "verify_" + ''.join(random.choice(string.letters) for num in range(40))
    AttributeError: module 'string' has no attribute 'letters'

Line 149, 151 when searching by hashtag

Traceback (most recent call last):
File "C:\Users\vikin\hitheretiktok\TikTokBot\tiktokbot.py", line 149, in
b = api.get_Video_By_TikTok(results[x], custom_did=did)
AttributeError: 'TikTokApi' object has no attribute 'get_Video_By_TikTok'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\vikin\hitheretiktok\TikTokBot\tiktokbot.py", line 151, in
b = api.get_Video_By_DownloadURL(
AttributeError: 'TikTokApi' object has no attribute 'get_Video_By_DownloadURL'

HELP

'ffmpeg' is not recognized as an internal or external command,
operable program or batch file.

Error with pip install mimetypes

Cant seem to install mimetypes, I'm on windows 10
I get this error:
ERROR: Could not find a version that satisfies the requirement mimetypes (from versions: none)
ERROR: No matching distribution found for mimetypes

not work !

hi ,
im test it but not work because selenium toktok api can't load video correctly ,
please review & if its possible change api to another build
finest regards

help me please

Pick a video length (1-3)

2-3 minutes
5-7 minutes
10-12 minutes
1
Select a video type
Trending
Hashtag
User
Sound
1
Traceback (most recent call last):
File "tiktokbot.py", line 114, in
verifyFp = "verify_" + ''.join(random.choice(string.letters) for num in range(40))
File "tiktokbot.py", line 114, in
verifyFp = "verify_" + ''.join(random.choice(string.letters) for num in range(40))
AttributeError: module 'string' has no attribute 'letters'

Country of each user?

Hi David Teather, thank you for you api.
is it possible add the 'country' to the user info?

AttributeError: type object 'TikTokApi' has no attribute 'get_instance'

Hey when i run your code i get

Traceback (most recent call last):
  File "C:\Users\dxtry\Desktop\BOT Dev\TikTokBot\tiktokbot.py", line 118, in <module>
    api = TikTokApi.get_instance(custom_verifyFp=verifyFp)
AttributeError: type object 'TikTokApi' has no attribute 'get_instance'

Can you help pls ?

Thanks :)

I am a beginner

I am a beginner
Can you explain how to download from the beginning
I'm trying this I can't help me please

Error while running the code

Hello,

When I run the program, I am getting the error session expired, can you please help me to fix the issue?

ImportError: cannot import name 'sync_playwright' from 'playwright'

C:\Users\NecroBoy\TikTokBot>python tiktokbot.py Traceback (most recent call last): File "C:\Users\NecroBoy\TikTokBot\tiktokbot.py", line 7, in <module> from TikTokApi import TikTokApi File "C:\Users\NecroBoy\AppData\Local\Programs\Python\Python39\lib\site-packages\TikTokApi\__init__.py", line 1, in <module> from TikTokApi.tiktok import TikTokApi File "C:\Users\NecroBoy\AppData\Local\Programs\Python\Python39\lib\site-packages\TikTokApi\tiktok.py", line 7, in <module> from playwright import sync_playwright ImportError: cannot import name 'sync_playwright' from 'playwright' (C:\Users\NecroBoy\AppData\Local\Programs\Python\Python39\lib\site-packages\playwright\__init__.py)

Hello! How to fix this error?

How to target hashtag instead of trend?

Hello,
I really appreciate your work, it's a really good project :D

I noticed that it download the same videos over time, even with days apart, so i wish to make possible to target specific hashtag where to download videos.

I saw in your tiktokapi that you created a specific api.search_by_hashtag(hashtag, count=10), but in this bot looks like the scraping process is managed by
# Vars count = 42 val = True while val is True: url = "https://m.tiktok.com/share/item/list?id=&type=5&count=" + \ str(count) + "&minCursor=10&maxCursor=10&_signature=" + "W5cHbxAVBvNS2316KIvp21uXB3"
Any hint on how to manage the scraping process with you api instead that this url request?
Thank you for your time, i really appreciate that!

๐Ÿ‘Š @davidteather

'ffprobe' is not recognized as an internal or external command, operable program or batch file.

'ffprobe' is not recognized as an internal or external command, operable program or batch file. Traceback (most recent call last): File "C:\Users\jvu90\Documents\Github_Repos\tiktok-scraping-with-python\splicedownload_TrendingVideos.py", line 148, in <module> vidLength = getLength('downloaded/' + str(x) + ".mp4") File "C:\Users\jvu90\Documents\Github_Repos\tiktok-scraping-with-python\splicedownload_TrendingVideos.py", line 20, in getLength secs = float(secsval) ValueError: could not convert string to float: ''

No response for getUser

I'm tryng to call api.getUser() but tiktok API looks like send no response

here's the log:

https://t.tiktok.com/api/user/detail/?uniqueId=charlidamelio&language=en&verifyFp=verify_kbx867qu_pap7vwms_HJOL_4sS7_9MKk_2jBZEkOKWfuv&_signature=_02B4Z6wo00f01WpljdgAAIBDvimpQwsvBYVqZalAAARw43

Converting response to JSON failed response is below (probably empty)

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/TikTokApi/tiktok.py", line 52, in getData
return r.json()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/models.py", line 898, in json
return complexjson.loads(self.text, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/init.py", line 348, in loads
return _default_decoder.decode(s)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/agus/python/tiktokbot/test.py", line 8, in
tiktoks = api.getUser('jharnabhagwani')
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/TikTokApi/tiktok.py", line 336, in getUser
return self.getData(api_url, b, proxy=proxy)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/TikTokApi/tiktok.py", line 56, in getData
raise Exception('Invalid Response')
Exception: Invalid Response

Process finished with exit code 1

Not secure

Hi, so im trying to run the bot and whenever im starting it im getting the following log on cmd

[18252:16376:0307/145527.641:ERROR:ssl_client_socket_impl.cc(941)] handshake failed; returned -1, SSL error code 1, net_error -202 [18252:16376:0307/145527.643:ERROR:ssl_client_socket_impl.cc(941)] handshake failed; returned -1, SSL error code 1, net_error -202 [18252:16376:0307/145528.049:ERROR:ssl_client_socket_impl.cc(941)] handshake failed; returned -1, SSL error code 1, net_error -202 [18252:16376:0307/145528.065:ERROR:ssl_client_socket_impl.cc(941)] handshake failed; returned -1, SSL error code 1, net_error -202 [18252:16376:0307/145528.094:ERROR:ssl_client_socket_impl.cc(941)] handshake failed; returned -1, SSL error code 1, net_error -202 [18252:16376:0307/145528.253:ERROR:ssl_client_socket_impl.cc(941)] handshake failed; returned -1, SSL error code 1, net_error -202 [18252:16376:0307/145534.177:ERROR:ssl_client_socket_impl.cc(941)] handshake failed; returned -1, SSL error code 1, net_error -202 [1688:18952:0307/145534.181:ERROR:gcm_channel_status_request.cc(145)] GCM channel request failed.

and in the browser it says the website is not secure and the tiktok website is not loading
Capture

No Module Named "TikTokApi"

Have issue when run py tiktokbot.py it's shown no module named "TikTokApi" line 7.

I have already install TikTokApi

pls can you help me i get this error !!

Traceback (most recent call last):
File "C:\Users\doubl\Desktop\TikTokBot-master\tiktokbot.py", line 123, in
res = api.byHashtag(x, count=count, custom_did=did)
File "C:\Users\doubl\AppData\Local\Programs\Python\Python38\lib\site-packages\TikTokApi\tiktok.py", line 711, in byHashtag
for t in res["itemList"]:
KeyError: 'itemList'

ypeError: cannot unpack non-iterable NoneType object

Gettings this error now, been running fine before.
Traceback (most recent call last):
File "tiktokbot.py", line 165, in
p1, p2 = calculateScale("downloaded/" + str(x) + ".mp4")
TypeError: cannot unpack non-iterable NoneType object

[BUG] HELP - secs = float(secsval) ValueError: could not convert string to float: ''

I installed playwright, all module requests, i flaged to true API_Endpoint in the API "tiktok.py" file and finally solved the Hashtag CAPTHA ERROR
After thate the new issue became when start the script from Tiktokbot.py

Traceback (most recent call last):
File "C:\Users\X\Desktop\TikTokbot\tiktokbot.py", line 152, in
vidLength = getLength('downloaded/' + str(x) + ".mp4")
File "C:\Users\X\Desktop\TikTokbot\tiktokbot.py", line 23, in getLength
secs = float(secsval)
ValueError: could not convert string to float: ''

Pip verssion 20.2
Python version 3.9

Do you suggest a specific version of FFMPEG,PLAYWRIGHT or PYTHON?

ERROR:root:Tiktok wants to display a catcha.

ERROR:root:Tiktok wants to display a catcha. Response is:
{"code":"10000","from":"","type":"verify","version":"","region":"va","subtype":"slide","detail":"bghAdiQWAooU6FchmbRx0rL2SN-YruF9XFp7egH5yZBgVLpmJyMTk27utHCOh2m8t3xBuCjeRQGZYGKLJqMF5ugIAWqOZ7MrIRSNpXkMwN-tHyfWZ34XrvaR1rfHdKFil3Ha0lCYuF904AqU2cXczq3ijRmFJyZ2u22AprYekDG2jakHuV4XcH2MDUBKtCWYPIzJ-wqqBSqd78SYsJm7ZDRW6awAS5*eA1FtzSuWBkFLuGiIQMRKyG0uqhhBSfdAgbKhXSPispzGYXMdsj314Vakf5ftEmxKYs7fF7RQ4WBeH-TzZaq-BgLaVHBdlAah9CMcRTPMB7hYCZk8sLRB1dAtLJ7GpV79GhnChL6ljOA6XJAfoMxTBlKVuz-s4oTkKikAAlxRP8bNr1y5OByigLEqGc3n3YamSbbJraHA..","verify_event":"","fp":"verify_mZCnHTecLgmXuUGEZmQUiARpZqzazKofUjzMCsRI","scene":"","verify_ticket":"","channel_mobile":"","sms_content":"","mobile":"","email":""}
ERROR:root:{'tt_webid': '2866585807669016319', 'tt_webid_v2': '2866585807669016319', 'tt_csrf_token': 'OyvfhaglRtQDitVB'}
Traceback (most recent call last):
File "C:\Users\lenovo\Desktop\TikTokBot-master\tiktokbot.py", line 127, in
res = api.byHashtag(x, count=count, custom_did=did)
File "C:\Users\lenovo\AppData\Local\Programs\Python\lib\site-packages\TikTokApi\tiktok.py", line 915, in by_hashtag
res = self.getData(url=api_url, **kwargs)
File "C:\Users\lenovo\AppData\Local\Programs\Python\lib\site-packages\TikTokApi\tiktok.py", line 270, 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

use private apis, not web thing

david, you should use tiktoks private apis rather than web because web will ratelimit and ip ban u in a week or even 3 days of using it.

[BUG] - Is the project working on ubuntu?

Describe the bug

the program stops and give me an error about string has no attribute letters

The buggy code
just the code from

Expected behavior

works properly

Error Trace (if any)

Traceback (most recent call last):
File "/home/ma/Scrivania/tiktok/tiktokbot.py", line 114, in
verifyFp = 'verify_Mycode'.join(random.choice(string.letters) for num in range(40))
File "/home/ma/Scrivania/tiktok/tiktokbot.py", line 114, in
verifyFp = 'verify_Mycode'.join(random.choice(string.letters) for num in range(40))
AttributeError: module 'string' has no attribute 'letters'
ma@ma-VirtualBox:~$

error playwright

when i run tiktokbot.py

ImportError: cannot import name 'sync_playwright' from 'playwright'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.