roju / tiktok-live-recorder

A Python script for recording TikTok live streams
MIT License
16 stars 2 forks source link

Remove Age Restriction Error #20

Open Shardyn opened 10 months ago

Shardyn commented 10 months ago

Is there a way to remove the age restriction error from the code? TikTok deems some "violent" video game streams to be age restricted so the recorder won't let me record them.

roju commented 10 months ago

TikTok makes it extra difficult to record age restricted live streams. I haven't been able to get that working yet. The error message is currently only there to let the user know why the recording has failed.

Marksmanship256 commented 10 months ago

error 2023-11-30_050746

I just got the same error. When opening the JSON file in the browser, I can still get the URL.

Shardyn commented 10 months ago

TikTok makes it extra difficult to record age restricted live streams. I haven't been able to get that working yet. The error message is currently only there to let the user know why the recording has failed.

Ah ok, makes sense

roju commented 10 months ago

Does anyone know of any age restricted creators that go live regularly? So I can test and possibly fix the issue. The one I was using previously does not go live any more.

Kai2PointOh commented 9 months ago

chaotically_dani1 is live almost every day and night and gets age restricted for vaping all day long.

Naderrnawar commented 8 months ago

chaotically_dani1 is live almost every day and night and gets age restricted for vaping all day long.

I just tried recording that one and got no error. Maybe age restriction got fixed when we had to add cookies.

It's only got age restricted on one live if he/she close and open again it's remove

zadrakar commented 7 months ago

I made hot fix by adding cookies extracted from browser (from "Cookie Quick Manager" for Firefox). I edited tiktok_bot.py:

import json as jsonread

# Read the cookies data from the JSON file
with open('cookies.json', 'r') as file:
    cookies_data = jsonread.load(file)

# Parse the cookies
cookies = {}
for cookie in cookies_data:
    cookies[cookie['Name raw']] = cookie['Content raw']

# edit those lines:
# json = req.get(url, headers=bot_utils.headers).json()
#like that:
json = self.req.get(url, headers=bot_utils.headers,  cookies=cookies).json()

I didn't like that mechanism of getting cookies through the browser exec anyway. I don't know much Python or GIT. Adding a new parameter and Git commit will take me a while unless someone fixes it properly.

patrik0208 commented 7 months ago

I made hot fix by adding cookies extracted from browser (from "Cookie Quick Manager" for Firefox). I edited tiktok_bot.py:

import json as jsonread

# Read the cookies data from the JSON file
with open('cookies.json', 'r') as file:
    cookies_data = jsonread.load(file)

# Parse the cookies
cookies = {}
for cookie in cookies_data:
    cookies[cookie['Name raw']] = cookie['Content raw']

# edit those lines:
# json = req.get(url, headers=bot_utils.headers).json()
#like that:
json = self.req.get(url, headers=bot_utils.headers,  cookies=cookies).json()

I didn't like that mechanism of getting cookies through the browser exec anyway. I don't know much Python or GIT. Adding a new parameter and Git commit will take me a while unless someone fixes it properly.

Can you make a video tutorial?I'm very stupid to this

Sullyscharger commented 6 months ago

I made hot fix by adding cookies extracted from browser (from "Cookie Quick Manager" for Firefox). I edited tiktok_bot.py:


import json as jsonread

# Read the cookies data from the JSON file

with open('cookies.json', 'r') as file:

    cookies_data = jsonread.load(file)

# Parse the cookies

cookies = {}

for cookie in cookies_data:

    cookies[cookie['Name raw']] = cookie['Content raw']

# edit those lines:

# json = req.get(url, headers=bot_utils.headers).json()

#like that:

json = self.req.get(url, headers=bot_utils.headers,  cookies=cookies).json()

I didn't like that mechanism of getting cookies through the browser exec anyway. I don't know much Python or GIT. Adding a new parameter and Git commit will take me a while unless someone fixes it properly.

Hi, do you mind doing a quick step by step, I'm slow when it comes to this lol.

zadrakar commented 6 months ago

This was quick fix with hard coded cookies. I am considering adding this option as an argument and passing the cookie path in it. Unfortunately, I don't know python very well. And I haven't had time for it yet.

Marksmanship256 commented 5 months ago

This was quick fix with hard coded cookies. I am considering adding this option as an argument and passing the cookie path in it. Unfortunately, I don't know python very well. And I haven't had time for it yet.

Hey, @zadrakar! Can you drop the entire code file with your hotfix? That "age restricted" keeps popping up, and the browser exstention ain't cutting it. Can you share the full code somewhere? Maybe on Pastebin or here?

Marksmanship256 commented 5 months ago

Ah, I figured it out. I used Google Chrome along with the "Cookie Manager" extension to export the cookies. Place the JSON file that you export using the extension in the root of the repository.

2024-04-13_235717

Marksmanship256 commented 5 months ago

Still getting age restricted even with @zadrakar cookie hot fix

2024-04-14_191219

Khotul commented 3 months ago

Still getting age restricted even with @zadrakar cookie hot fix

2024-04-14_191219

@Marksmanship256 The cookies method is working for me, perhaps something else is wrong in your set up. Are you running with the browser_exec flag? If so, the code will try to grab the link using browser extension rather than the json query you changed on your screenshot. Try these things:

And if it sitll doesn't work despite that, try logging on tiktok on Firefox browser and extract those cookies. Maybe there is something in Chromium based browsers that prevents it from working, despite it working with Firefox cookies.

Liam942 commented 3 months ago

I got this issue again a few days ago after not seeing it for very long. I saw on another github page that If cookies no longer works it seems you have to create a new account and extract cookies from there. This seems to work for me.