-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[BUG] CORS Error When Loading Comments on TikTok #23038
Comments
I tried to reproduce this in Google Chrome, without Playwright involved. Navigating to the url above, I see a network request
This only happens the first time I open the page in Incognito window. After reload, everything works fine. I guess that's how tiktok's page works? Since Playwright always loads your page in the fresh context, it would have the same issue. Try reloading the page with |
Reloading with I've also tried messing with User-Agent information, and that doesn't seem to resolve the problem. I suspect the reason why it didn't work for you the first time was that you didn't have the Having that cookie in Playwright doesn't seem to change the result though. |
It's also interesting to note, Playwright's Chromium inspection window shows that the comment request doesn't have a Remote Address field, but all the other requests do. On my regular browsers, that field is always populated. It's possible that that field gets populated on a successful request, so it might not matter. |
@Russell-Newton I was able to repro the issue, and I see the Given the above, I don't think there is a bug in Playwright that we would be fixing, so I'll close the issue. |
That points me in hopefully the right direction. Thanks! |
Context:
Steps to Reproduce
I've found that the easiest way to confirm the faulty behavior is with a headed browser so that you can check the console and network tabs of the inspector. You can run the following code in a terminal:
And then navigate to any video on TikTok (e.g.: https://www.tiktok.com/@tiktok/video/6584647400055377158)
To be honest I'm not sure what the best pure-code way to test this would be because you need to read the network requests to see what's going on with a specific endpoint.
Describe the bug
I noticed this when trying to resolve issues in my own repository (related reports: Russell-Newton/TikTokPy#9, Russell-Newton/TikTokPy#23, Russell-Newton/TikTokPy#30).
When Playwright attempts to execute the API call that TikTok makes to grab comments on a video, it makes a request to a API endpoint that looks something like
https://us.tiktok.com/api/comment/list/
. This resembles the endpoints of all other API requests that Playwright has to make in order for TikTok to behave normally, but for some reason this one always sends back a CORS error.The console always says something like:
In previous versions of Playwright (1.29.x), this was only an issue on Chromium, but now it seems to be an issue for Firefox too.
I would expect that this API call should work, considering it works on my regular desktop browser, and all the other API calls work.
All of my knowledge and experience with web development and this sort of stuff is self-taught and limited, and I've tried everything I know how to do, so I'm left to assume this is a bug with Playwright. If there's any sort of further information needed, I'll do my best to get it.
The text was updated successfully, but these errors were encountered: