546200350 / tiktokuploder Goto Github PK
View Code? Open in Web Editor NEWUpload video to Tik Tok by sessionId
License: MIT License
Upload video to Tik Tok by sessionId
License: MIT License
Hello, I'm getting this error, if anyone could help please.
File "C:\Users\Nathan\Documents\RSL\uploader.py", line 81, in uploadVideo response = execjs.compile(open('./js/webssdk.js').read()).call('getSecretUrl', data) ^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: './js/webssdk.js'
a
i there thanks for your work that great script !
im asking when i run the command i get this error
tempInfo = r.json()['project']
and keyerror = 'project'
is there any json file i must create or downloading it ?
Hey !
Keeping up with the project after few weeks (finishing my exams :p)
What's the purpose of the new things added like x-bogus or the js script thing ? Does Tiktok reinforced it's security for their API ?
For some reason the URL returns 200 but content is empty...
Traceback (most recent call last):
File "/github/TikTokUploder/uploader.py", line 120, in
uploadVideo(args.session_id, args.path, args.title, args.tags, args.users, args.url_server)
File "/github/TikTokUploder/uploader.py", line 98, in uploadVideo
if r.json()["status_code"] == 0:
File "/usr/lib/python3.10/site-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.10/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.10/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)
When I upload a video, the video is automatically marked as private. Is it possible for the video to automatically be public on upload?
Uploaded video has no sound
Awesome work !
Just a worry about it, is there a risk that TikTok detects it and shadowban your account by uploading with the API like that?
Can i add video to playlist ?
say i can find music_id. where to add the param?
Hi bro,
Can you figure out how to upload video with music ID so video's sound will be not Original Sound but it shows a Title of music from the ID?
Thanks
[-] An error occured while reaching https://www.tiktok.com/api/v1/web/project/create/?creation_id=qUfHZlRlWa9RLVQae6TN0&type=1&aid=1988
[-] Please try to change the --url_server argument to the adapted prefix for your account
Traceback (most recent call last):
File "/Users/davidliao/Documents/main/main.py", line 139, in <module>
uploadVideo(SESSION_ID, file, TITLE, TAGS, USERS)
File "/Users/davidliao/Documents/main/uploader.py", line 32, in uploadVideo
creationID = tempInfo["creationID"]
UnboundLocalError: local variable 'tempInfo' referenced before assignment
tried 'us' for --url_server but same issue. also tried putting "url_prefix = "www" into the function call but getting same issue, same with function definition in uploader.py
i am not on a proxy/vpn should not be a serverside issue.
is there any option to upload the video as private ?
After all procedures I am getting string:
{"status_code":0,"status_msg":"success","info":{"projectID":"86*****87","version":1,"type":1,"status":0},"extra":{"now":1682881881000,"fatal_item_ids":[],"logid":"2023043********8"},"log_pb":{"impr_id":"202304301*******8"}}
but video does not appear in my profile.
Could you please tell me, what I am doing wrong?
P.S. Im using polish proxy. without proxy same happens
Can you add support for being able to "tag" other accounts?
{
"status_code": 0,
"status_msg": "success",
"info": {
"status": 0,
"projectID": "7447219460",
"version": 1,
"type": 1
},
"extra": {
"now": 1676477513000,
"fatal_item_ids": [],
"logid": "20230215161152BD1E106A33B693065646"
},
"log_pb": {
"impr_id": "20230215161152BD1E106A33B693065646"
}
}
我用go改写了所有的api,每个api都貌似拿到了成功的响应,上面的是最后一个[https://www.tiktok.com/api/v1/web/project/post/?aid=1988]api的响应,貌似没问题,但是在首页看不到上传的视频,不知道是哪个步骤出错了
This is not an issue just a request so I will remove or please close it, but I just wanted to ask if anyone knows how complex it would be to specify an effect, I assume one would have to include timestamps of when to add it and would need an effect name.
Hello, I tried to download the new updated code for those who do not have access to the API us.tiktok I live in Europe so I go through "www". However I still have this error and I tried to disconnect / reconnect in order to have a new session_id however I have the same problem. Did I miss a step?
Thanks for your help.
Here's my error :
Hi,
I have this error :
File "c:\Users\benja\Desktop\tiktok bot\auto-uploder\TikTokUploder-main\uploader.py", line 26, in uploadVideo eo tempInfo = r.json()['project'] KeyError: 'project'
Because the 'r' variable only contains :
{"status_code":0,"status_msg":"url doesn't match","log_pb":{"impr_id":"202305171653389A43C48F8C2C771378CF"}}
I would know how can I solve this issue.
(Sorry for my english I'm French)
Thanks :)
It has been a few days since I am using the upload.py script, and I have the same issue every time I try to run it on a different device than my laptop. For instant I always get this error when I try running it on my raspberry pi:
[-] An error occured while reaching https://www.tiktok.com/api/v1/web/project/post/?aid=1988
r = <Response [200]>
r.content = b'{"status_code":4,"status_msg":"Server is currently unavailable. Please try again later.","log_pb":{"impr_id":"20230419125536859ED03C61F227194B99"}}
Whenever I post with this tool on TikTok, my video gets 0 views (stuck in fantom mode), whatever the video, whatever the account.
(I also tested with some apps that allow to post automatically and they also got stuck on 0 views.)
Am I the only one who doesn't have view when I use this tool?
I think Tiktok has some verification that you're using the Tiktok app/website and not just the API.
Maybe try to replicate some requests that are made like these ones.
Here's a guy that I found on GitHub who explored a bit the Tiktok API: https://github.com/xtekky?language=&page=1&q=Tiktok&sort=stargazers&tab=repositories&type=source .
Maybe we will find something interesting to improve our uploader.
Yesterday, my videos has stopped to upload. After some debugging, I have notised that we need to provide some "htc6j8njvn-" params when sending request to "/v1/web/project/post/?aid=1988". Any ideas how to generate them?
[-] An error occured while reaching https://us.tiktok.com/api/v1/web/project/post/?aid=1988
r = <Response [200]>
r.content = b'{"log_pb":{"impr_id":"2023052012492532CEE93A76E76F5AE521"},"status_code":8,"status_msg":"Login expired"}'
how to fix this?
Hi, I'm getting those errors:
`Traceback (most recent call last):
File "C:\Users\Nathan\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connection.py", line 174, in _new_conn
conn = connection.create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Nathan\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\util\connection.py", line 72, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Nathan\AppData\Local\Programs\Python\Python311\Lib\socket.py", line 962, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno 11001] getaddrinfo failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Nathan\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "C:\Users\Nathan\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "C:\Users\Nathan\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 1042, in _validate_conn
conn.connect()
File "C:\Users\Nathan\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connection.py", line 363, in connect
self.sock = conn = self._new_conn()
^^^^^^^^^^^^^^^^
File "C:\Users\Nathan\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x0000021AD576DED0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Nathan\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\adapters.py", line 489, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File "C:\Users\Nathan\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File "C:\Users\Nathan\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\util\retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='fr.tiktok.com', port=443): Max retries exceeded with url: /upload/ (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000021AD576DED0>: Failed to establish a new connection: [Errno 11
001] getaddrinfo failed'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Nathan\Documents\RSL\index.py", line 259, in
uploadVideo(session_id, file, title, tags, users, url_prefix)
File "C:\Users\Nathan\Documents\RSL\uploader.py", line 15, in uploadVideo
r = session.get(url,headers = headers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Nathan\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 600, in get
return self.request("GET", url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Nathan\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Nathan\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Nathan\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\adapters.py", line 565, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='fr.tiktok.com', port=443): Max retries exceeded with url: /upload/ (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000021AD576DED0>: Failed to establish a new connection: [Errno
11001] getaddrinfo failed'))Here is my code:
session_id = "533b414b12afdfce1dac569ca7a769e0"
file = "video.mp4"
tags = ["pourtoi", "histoire", "reddit", "fyp"]
users = []
url_prefix = "fr"
uploadVideo(session_id, file, title, tags, users, url_prefix)`
[-] An error occurred while reaching https://www.tiktok.com/api/v1/web/project/create/?creation_id=gxYkhL6dPsIUs73ab6CPx&type=1&aid=1988
[-] Please try to change the --url_server argument to the adapted prefix for your account
Hello, can we add a music from Tiktok? Thanks for answering
tempInfo = r.json()['project']
KeyError: 'project'
Hi, I'm getting this error, if someone would have an idea how to correct it please.
============视频上传成功===========
[-] An error occured while reaching https://www.tiktok.com/api/v1/web/project/post/?aid=1988
r = <Response [403]>
r.content = b'\n<TITLE>Access Denied</TITLE>\n\n
\nReference #18.6ef1002.1685281775.34947a37\n\n\n'
============发布失败===========
[-] An error occured while reaching https://www.tiktok.com/api/v1/web/project/post/?aid=1988
r = <Response [403]>
r.content = b'\n<TITLE>Access Denied</TITLE>\n\n
\nReference #18.6ef1002.1685281775.34947a37\n\n\n'
Hey, I'm in Australia and the code works for a friend of mine in Canada, but I get this error when I run it. Is it something on TikToks backend that's not working or am I doing something wrong. When I click the link on chrome I get sent to a white page with this text "Server is currently unavailable. Please try again later". But when I click it on firefox its a white background.
============Start uploading video===========
C:\Users\AppData\Roaming\Python\Python310\site-packages\urllib3\connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'tos-awsuseast19-up.tiktokcdn.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
============Video uploaded successfully===========
============Publish failed===========
[-] An error occured while reaching https://www.tiktok.com/api/v1/web/project/post/
r = <Response [200]>
r.content = b'{"log_pb":{"impr_id":"202307100122452E3962ECA6B41833A22F"},"status_code":4,"status_msg":"Server is currently unavailable. Please try again later."}'
PS C:\Users\Desktop\Tiktok Software\Tiktok-AI-main>
Hello, is it possible to mention a user when you upload a video?
I believe the end point has changed or was json has changed:
$ python3 uploader.py -i SESSION_ID -t "Title" -p "video.mp4"
Traceback (most recent call last):
File "/Users/<>/repo/TikTokUploder/uploader.py", line 112, in <module>
uploadVideo(args.session_id, args.path, args.title, args.tags)
File "/Users/<>/repo/TikTokUploder/uploader.py", line 25, in uploadVideo
tempInfo = r.json()['project']
KeyError: 'project'
You added a parameter -s but it is not used in your code
[-] An error occurred while reaching https://www.tiktok.com/api/v1/web/project/create/?creation_id=gxYkhL6dPsIUs73ab6CPx&type=1&aid=1988
[-] Please try to change the --url_server argument to the adapted prefix for your account
Hello, I'm getting this error when the video is getting publish. If anyone could help please.
============Video uploaded successfully=========== [-] An error occured while reaching https://us.tiktok.com/api/v1/web/project/post/ r = <Response [403]> r.content = b'<HTML><HEAD>\n<TITLE>Access Denied</TITLE>\n</HEAD><BODY>\n<H1>Access Denied</H1>\n \nYou don\'t have permission to access "/api/v1/web/project/post/?app_name=tiktok_web&channel=tiktok_web&device_platform=web&aid=1988&X-Bogus=DFSzswVYoNr4PX42tJMRLM9WX7Ju" on this server.<P>\nReference #18.cef71502.1688673535.51da5ca9\n</BODY>\n</HTML>\n' ============Publish failed=========== [-] An error occured while reaching https://us.tiktok.com/api/v1/web/project/post/ r = <Response [403]> r.content = b'<HTML><HEAD>\n<TITLE>Access Denied</TITLE>\n</HEAD><BODY>\n<H1>Access Denied</H1>\n \nYou don\'t have permission to access "/api/v1/web/project/post/?app_name=tiktok_web&channel=tiktok_web&device_platform=web&aid=1988&X-Bogus=DFSzswVYoNr4PX42tJMRLM9WX7Ju" on this server.<P>\nReference #18.cef71502.1688673535.51da5ca9\n</BODY>\n</HTML>\n'
In Windows you can get an error like this:
File "C:\Python\Python310\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode characters in position x-y
This happens because per default use the cp1252 encoding, but you must use utf-8 so to fix it:
uploader.py
replace this:
response = execjs.compile(open('./js/webssdk.js').read()).call('getSecretUrl', data)
by this:
response = execjs.compile(open('./js/webssdk.js', encoding='utf-8').read()).call('getSecretUrl', data)
execjs > _external_runtime.py
replace this:
def _exec_with_pipe(self, source):
cmd = self._runtime._binary()
p = None
try:
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, cwd=self._cwd, universal_newlines=True)
input = self._compile(source)
if six.PY2:
input = input.encode(sys.getfilesystemencoding())
stdoutdata, stderrdata = p.communicate(input=input)
ret = p.wait()
finally:
del p
self._fail_on_non_zero_status(ret, stdoutdata, stderrdata)
return stdoutdata
by this:
def _exec_with_pipe(self, source):
cmd = self._runtime._binary()
p = None
try:
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, cwd=self._cwd, universal_newlines=True, encoding='utf-8')
input = self._compile(source)
if six.PY2:
input = input.encode(sys.getfilesystemencoding())
stdoutdata, stderrdata = p.communicate(input=input)
ret = p.wait()
finally:
del p
self._fail_on_non_zero_status(ret, stdoutdata, stderrdata)
return stdoutdata
Hello, I'm getting this new error. If anyone could help please.
File "C:\Users\Nathan\Documents\RSL\uploader.py", line 8, in <module> from .util import assertSuccess, printError, getTagsExtra, uploadToTikTok, log, getCreationId ImportError: attempted relative import with no known parent package
after uploading, the video doesnt play but the audio does
Hii, I uploaded over 50 videos using this TikTokUploader, but I got maximum 50 views per video.
X-Bogus Just like this jiji262/douyin-downloader
Everything was fine, but today I ran into a problem:
tempInfo = r.json()['project']
KeyError: 'project'
I know about the 'us->www' error and yestarday its work fine...
does anyone have this error? if not, I will look at my side
> Hi,
I have this error :
File "c:\Users\benja\Desktop\tiktok bot\auto-uploder\TikTokUploder-main\uploader.py", line 26, in uploadVideo eo tempInfo = r.json()['project'] KeyError: 'project'
Because the 'r' variable only contains :
{"status_code":0,"status_msg":"url doesn't match","log_pb":{"impr_id":"202305171653389A43C48F8C2C771378CF"}}
I would know how can I solve this issue. (Sorry for my english I'm French)
Thanks :)
Suggest you check if your session-id expired yet? Renew the session-id and repalce with the new one. I think it will work well.
Originally posted by @devopjj in #26 (comment)
python3 uploader.py -i {my_session_id} -p my_video.mp4 -t "MY SUPER TITLE" --tags Funny Joke Fyp
Traceback (most recent call last):
File "/Users/fabio/Documents/TikTokUploder/uploader.py", line 112, in
uploadVideo(args.session_id, args.path, args.title, args.tags)
File "/Users/fabio/Documents/TikTokUploder/uploader.py", line 25, in uploadVideo
tempInfo = r.json()['project']
KeyError: 'project'
I'm but print(r.json()) and return is
{'log_pb': {'impr_id': '20230***.....'}, 'status_code': 8, 'status_msg': 'Login expired'}
Fix: #4
recently I am not caplabe to upload videos for this issue, does anyone has a clue what could be the solution ?
Error: Command failed: python uploader.py -i "<SSID>" -p "...video.mp4" -t "🌳 Compartir Crece 🌱 " --tags fyp foryoupage
...\anaconda3\lib\site-packages\urllib3\connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'tos-awsuseast16-up.tiktokcdn.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
Traceback (most recent call last):
File "...\anaconda3\lib\site-packages\requests\models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "...\anaconda3\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "...\anaconda3\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "...\anaconda3\lib\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 "...\uploader.py", line 117, in <module>
uploadVideo(args.session_id, args.path, args.title, args.tags, args.users)
File "...\uploader.py", line 96, in uploadVideo
if r.json()["status_code"] == 0:
File "...\Users\Miguel\anaconda3\lib\site-packages\requests\models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
File "C:\Users\MAINUSER\TikTokUploder\uploader.py", line 8, in
from .util import assertSuccess, printError, getTagsExtra, uploadToTikTok, log, getCreationId
ImportError: attempted relative import with no known parent package
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.