ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!

Jump to content



Photo

Python Teenchat API


  • Please log in to reply
Python Teenchat API

#1

someguyagain
someguyagain
    Offline
    34
    Rep
    15
    Likes

    Connor

Posts: 58
Threads: 10
Joined: May 12, 2024
Credits: 0

Half year registered
#1
[hide]import cloudscraper
import api

# I hate this site I signed a test account up and got hit up by some many pedophiles like leave me tf alone

# Site is ran on wordpress ????
# Bypass that lame ass cloudflare screen
requester = cloudscraper.create_scraper()

# To get cloudflare solution use a site such as
# https://www.capsolver.com/
# This is documentation you want to look at
# https://docs.capsolver.com/guide/antibots/cloudflare_turnstile.html
# They use cloudflare turnstile

"""
Cloudflare solution demo

payload = {
"clientKey": "YourApiKey",
"task": {
"type": "AntiTurnstileTaskProxyLess",
"websiteURL": "https://www.teen-chat.org/",
"websiteKey": "0x4AAAAAAASc7Y2nLj9I_suK", #I'm so kind and provided website key jk
}
}
response = requests.post("https://api.capsolver.com/createTask", json=payload)
"""

# Information
# Gender Paramater
# 1 Is Male
# 2 Is Female
# 3 Is other ????

# Extra Information
# They only support certain types of emails like webmail type emails e.g support@Python.com for example wouldn't work
# It only supports like @gmail.com unsure of others please tell me if you find any others.

"""
Status Codes ( returned by text ) createAccount

6: invalid email
10: email already exists
5: username already exists
17: password too short / long
4: Username too short / long

Status Codes ( returned by test ) resetPassword

2: Error incorrect or user doesn't exist
1: Succesfully sent
"""

headers = {
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "X-Requested-With": "XMLHttpRequest", "Accept": "*/*", "Accept-Encoding": "gzip, deflate, br, zstd"
}

def getPHPSessionID(domain=None, userID=None, utk=None, ssid=None): # Unsure if I even need this but we move I just got it anyway to be on safe side to avoid debugging !
headers= {
"cookie": f"tc4_userid={userID}; tc4_utk={utk}; tc4_ssid={ssid};",
"X-Requested-With": "XMLHttpRequest",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
}
return requester.get(domain, headers=headers).cookies.get("PHPSESSID") # mmmm cookies

def createAccount(email=None, username=None, password="defaultdance", gender: int=2, chatroom="home", userAgent=None, age: int=17, cloudflareSolution=None):
# I don't recommend you have to then verify the email etc it's so ass bro
# Ass site,
if email == None or username == None or cloudflareSolution == None: return False

targetURL = "https://www.teen-chat.org/chat/system/action/registration.php"

# I hate my life
if userAgent != None: headers["User-Agent"] = userAgent

# the lame ass payload to register on this goof ball of a site
payload = {
"token": 0,
"cp": chatroom, # There's like bunch chat rooms but I'm fucking lazy
"username": username,
"password": password,
"gender": gender,
"email": email,
"age": age,
"recaptcha": cloudflareSolution # Example: 0.6VyL1cP9p9_3hZVb5w-97LuEE9rPZXNJrgpSPO-nGKdIKxptoDYxIZxN_ it is longer than that though by miles
}

response = requester.post(targetURL, headers=headers, data=payload)

# This site doesn't return any different status codes it returns mini-codes via .text
# Ass i know right
# I spent good 30mins finding some these out

# Status code
# Then the cookies
return response.text, response.cookies

def resetPassword(chatroom="home", email=None): # Doesn't return anything valuable just good for reseting your password ig?
# You could probably scrape every email registered
# Unsure if there is ratelimit
# Imagine the spamming you could do if their isn't ????

if email == None: return False

targetURL = "https://www.teen-chat.org/chat/system/action/recovery.php"
# finna post this shit to the bin

payload = {
"token": 0,
"cp": chatroom,
"remail": email
}

response = requester.post(targetURL, headers=headers, data=payload)
return response.text, response.cookies

def guestAccountCreate(username=None, cloudflareSolution=None, userAgent=None, gender: int=2, chatroom="home", age: int=17): # Does return some information in the cookies
# tc4_userid
# tc4_ssid
# tc4_utk

# Thank me later
# The ratelimit is about 3 accounts per 10 minutes
# I think guest accounts are temporary though.

if username == None or cloudflareSolution == None or userAgent == None: return False

""" DOESN'T RETURN 2 PARAMATERS PLEASE READ """

targetURL = "http://www.teen-chat.org/chat/system/action/login.php"

payload = {
"token": 0,
"cp": chatroom,
"gusername": username,
"ggender": gender,
"gage": age,
"recaptcha": cloudflareSolution,
"Connection": "keep-alive"
}

if userAgent != None: headers["User-Agent"] = userAgent

response = requester.post(targetURL, data=payload, headers=headers)
return response.cookies.get("tc4_userid"), response.cookies.get("tc4_utk"), response.cookies.get("tc4_ssid")

def login(user=None, password=None, chatroom="home"): # Does return some information in the cookies
# I'm genuinely supruised there's no captcha for login
# Botters finna have field day

# tc4_userid
# tc4_ssid
# tc4_utk

""" DOESN'T RETURN 2 PARAMATERS PLEASE READ """

if user==None or password == None: return False

targetURL = "https://www.teen-chat.org/chat/system/action/login.php"

payload = {
"token": 0,
"cp": chatroom,
"password": password,
"username": user
}

# https://imgur.com/a/7m0wzkI
# If you see this, I'm recreating gta 5 source code!

response = requester.post(targetURL, data=payload, headers=headers)
return response.cookies # ????

def sendMessage(ssid=None, userID=None, utk=None, chatroom="chat", quote=0, message="4 Big guys.", sessionId=None, token=None): # This bitch returns json
if ssid==None or userID == None or utk == None: return False # Provide the required data

targetURL = "https://www.teen-chat.org/chat/system/action/chat_process.php"
payload = {
"token": token,
"cp": chatroom,
"content": message,
"quote": quote
}

headers= {
"cookie": f"tc4_userid={userID}; tc4_utk={utk}; tc4_ssid={ssid}; PHPSESSID={sessionId};",
"X-Requested-With": "XMLHttpRequest",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
}

# for some weird reason guest accounts have different pway of sending messages god another 2 hours of debugging
# Can someone give me phonk playlist at this point

# This gave me hope
# https://imgur.com/7FGOvOt
# They got whole ass radio station in here

response = requester.post(targetURL, headers=headers, data=payload)
return response.text

def getToken(ssid=None, utk=None, userID=None): # When you get new sessionID a mini token changes which is used for like your messages etc
if ssid == None or utk == None or userID == None: return False

targetURL = "https://www.teen-chat.org/chat/"
headers = {
"cookie": f"tc4_userid={userID}; tc4_utk={utk}; tc4_ssid={ssid};"
}
# This is terrible way to handle it
response = requester.get(targetURL, headers=headers)
splitUTK = response.text.split("var utk = '")[1].split("'")[0]
return response.cookies.get("PHPSESSID"), splitUTK
[/hide]

This is only basic API but I did what I could especially with how much this site pissed me off it was terribly bad. No good backend nothing. For guest accounts you'll need to improve send message part. creating a guest account does work but the site has some huge constraints and after phew days I was like I can't be bothered anymore. I hope you enjoy my hellish code.

 

This is api for teenchat

https://www.teen-chat.org/chat/

 

Create guest accounts

send chat messages

create accounts

reset password

get token

get php session id

 

It's not much but I'll work on it in future I hope someone can improve this and use it for whatever you want with some proxys you could easily use it to promote stuff in the chat via bots. Next time I do plan to make it so you can private message users and a auto-mod detection to avoid getting banned you can also use it for automating small messages from registered accounts such as promoting your discord or services use it how you wish and have fun.

 

I know my code is terrible but I wanted to contribute anyway I could

 

if anyone wants I can cover the grounds of using captcha solver to register

 

If any concerns reply I'll answer in minute to phew hours.


  • 0

#2

someguyagain
someguyagain
    Offline
    34
    Rep
    15
    Likes

    Connor

Posts: 58
Threads: 10
Joined: May 12, 2024
Credits: 0

Half year registered
#2

Unsure why the code aligned to left I'm super sorry about that you'll have to indent those part


  • 0

#3

someguyagain
someguyagain
    Offline
    34
    Rep
    15
    Likes

    Connor

Posts: 58
Threads: 10
Joined: May 12, 2024
Credits: 0

Half year registered
#3

Also just realized this shit ain't even hide I'm so bad at threads oh well have fun you guys 


  • 0


 Users browsing this thread: and 1 guests