tiktok-downloader
tiktok-downloader copied to clipboard
Error: SyntaxError: Unexpected end of JSON input
Describe the bug I get an error when downloading a single video.
[*] URL: https://www.tiktok.com/@.....
Error: SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at getVideo (/home/tbm/src/tiktok-downloader/index.js:126:24)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /home/tbm/src/tiktok-downloader/index.js:320:20
Response body:
/home/tbm/src/tiktok-downloader/index.js:133
if (res.aweme_list[0].aweme_id != idVideo) {
^
TypeError: Cannot read properties of undefined (reading 'aweme_list')
at getVideo (/home/tbm/src/tiktok-downloader/index.js:133:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /home/tbm/src/tiktok-downloader/index.js:320:20
Node.js v18.19.0
I get this error when downloading a video: Single download, without watermark.
It happens on every single video I tried. It was working fine a few days ago.
Can you reproduce this issue?
Seems like a server error, so the easy fix for me is to change useast1a
to useast2a
here:
const API_URL = https://api16-normal-c-useast1a.tiktokv.com/aweme/v1/feed/?aweme_id=${idVideo};
I can confirm that this change makes it work for me.
Would be good if the tool would print a clearer error (and maybe fall back to another host).
@DD7-13 This fix worked but how did you know to change that line?
@DD7-13 This fix worked but how did you know to change that line?
I don't know, actually. I just tried to change the server name and it worked. After that I tried a few other possible names, but no luck
So does this repo work then? and any beginner info in how to get it setup?
@timmbobb Are you talking in very general terms, do you know git clone and npm i or are you referring to how certain parts of the repo are broken when you first clone it?
I actually figured it out. Got the part where the server wasn't working or region or whatever.
On Sun, Mar 17, 2024 at 4:46 PM James Gore @.***> wrote:
@timmbobb https://github.com/timmbobb Are you talking in very general terms, do you know git clone and npm i or are you referring to how certain parts of the repo are broken when you first clone it?
— Reply to this email directly, view it on GitHub https://github.com/n0l3r/tiktok-downloader/issues/50#issuecomment-2002627811, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM3WGSIBXWL22MKTBWFZ5OTYYYFKJAVCNFSM6AAAAABEVPJVUOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBSGYZDOOBRGE . You are receiving this because you were mentioned.Message ID: @.***>
Getting the same issue now... Tried switching between a handful of server URLs (useast1a, useast2a, useast5) with no luck... Anyone ran into this before?
Its changing frequently now with the U.S tiktok ban but even yt-dlp doesnt have the new url yet.
I used api31-normal-probe-useast2a.tiktokv.com
it's works for me
@tdevly Can you show how the url is formed on line 124 because I replaced my url to
const API_URL = `https:/api31-normal-probe-useast2a.tiktokv.com/aweme/v1/feed/?aweme_id=${idVideo}`;
but I am still getting the error that @tbm had.
@jgore077 It worked this time through the terminal, but it stopped working again
@tdevly I can confirm that this doesnt work as a replacement but what method did you obtain this api endpoint?
I have exactly the same issue as you guys. I tried checking multiple combinations of API numbers and regions using a for loop but none of them worked. Did you find any working API URL?
I think we should at least add some error handling here so that it's more understandable what's going on when this happens. A "Incorrect API endpoint" error would be much more helpful, and more accurate then what is currently displayed when this happens.
I tried all the above suggestions still no luck.. having the same issue
@jgore077 I have tried each url in this list https://gist.github.com/RupGautam/e6953b6e0a68ece63e6721309135190f
To download the video, I used this: https://www.tikwm.com/video/media/play/${videoID}.mp4
Did the job for everyone here and tried bruteforcing every domain in that list. Found some that worked but upon sending a second request they stop returning JSON.
Not sure if it's just random (probably) or anything, but it definitely seems like no matter the "working domain" you'll find, the /aweme/v1/feed
endpoint is being deprecated by TikTok and will stop working anyway.
Seems like a whole new solution is required. Some downloader bots still seem to work, not sure what's their approach.
RIP /aweme/v1/feed
.
Did the job for everyone here and tried bruteforcing every domain in that list. Found some that worked but upon sending a second request they stop returning JSON.
Not sure if it's just random (probably) or anything, but it definitely seems like no matter the "working domain" you'll find, the
/aweme/v1/feed
endpoint is being deprecated by TikTok and will stop working anyway.Seems like a whole new solution is required. Some downloader bots still seem to work, not sure what's their approach.
RIP
/aweme/v1/feed
.
![]()
they use mobile private API which requires special headers
Did the job for everyone here and tried bruteforcing every domain in that list. Found some that worked but upon sending a second request they stop returning JSON. Not sure if it's just random (probably) or anything, but it definitely seems like no matter the "working domain" you'll find, the
/aweme/v1/feed
endpoint is being deprecated by TikTok and will stop working anyway. Seems like a whole new solution is required. Some downloader bots still seem to work, not sure what's their approach. RIP/aweme/v1/feed
.![]()
they use mobile private API which requires special headers
Do you have any idea on how to implement this???
I found a working repo here . This is the endpoint its using "https://api22-normal-c-alisg.tiktokv.com/"
. This didnt work as a drop in replacement unfortunately.
Well, I have a pull request waiting to be accepted that allows people to deploy this to google cloud, and it works currently. Pull request just needs to be accepted. It's also a little bit more of an involved setup than just using the command line though. Still free which is nice.
Well, I have a pull request waiting to be accepted that allows people to deploy this to google cloud, and it works currently. Pull request just needs to be accepted. It's also a little bit more of an involved setup than just using the command line though. Still free which is nice.
It looks your using the old api endpoint, is this right?
Well, I have a pull request waiting to be accepted that allows people to deploy this to google cloud, and it works currently. Pull request just needs to be accepted. It's also a little bit more of an involved setup than just using the command line though. Still free which is nice.
It looks your using the old api endpoint, is this right?
Not using any of our endpoints at all. Look in the server.js of the pull request.
check latest version please