Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 04-26-2024, 05:47 PM   #1
Akali
Confirmed User
 
Akali's Avatar
 
Industry Role:
Join Date: Apr 2023
Posts: 73
Chaturbate API for online models.

Can someone explain to me what am I doing wrong.
Why does this curl returns me one entry but not the room of shinyways (who is online) but some other model?

https://chaturbate.com/api/public/af...ways& limit=1

And this, return huge array of whole bunch of models and their details including shinyways, but she is hidden in the middle somewhere.

https://chaturbate.com/api/public/af...name=shinyways

What do I do just to check if username=shinyways is online.. That is all I'm trying to do.
__________________
Trading webcam Links.
Best offer takes it.
Akali is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-26-2024, 06:57 PM   #2
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 54,546
username is not a valid query arg, so when you are parsing the first result, its ignoring username and just giving you 1 result of the onlinecams.

the second one you have no limit, so she will show up somewhere in there.
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


my contact: fris at fris.net
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-26-2024, 07:43 PM   #3
Akali
Confirmed User
 
Akali's Avatar
 
Industry Role:
Join Date: Apr 2023
Posts: 73
Quote:
Originally Posted by fris View Post
username is not a valid query arg, so when you are parsing the first result, its ignoring username and just giving you 1 result of the onlinecams.

the second one you have no limit, so she will show up somewhere in there.
Thank you.
So what is the most efficient way to check for individual model if she is online or not? Just look through entire feed of "models on line"?
__________________
Trading webcam Links.
Best offer takes it.
Akali is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-26-2024, 07:52 PM   #4
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 54,546
Quote:
Originally Posted by Akali View Post
Thank you.
So what is the most efficient way to check for individual model if she is online or not? Just look through entire feed of "models on line"?
yes check for value if they are online or not.

you will want the seconds_online value in the array.
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


my contact: fris at fris.net
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-26-2024, 09:06 PM   #5
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,544
You can limit it some more.

If the model has a particular tag (or tags) that they alwas use, you can pull for those tags. Only issue is if the model stops using those tags the query won't return them even if they are online.

&tag=tag_name ex: &tag=petite&tag=lesbian

also include the gender field &gender=f or &gender=m ...etc

if you know what country is usually included in their record, include the region field. &region=northamerica

Each additional parameter lowers the number of possibilities

Each call to the api can get up to 500 records back So loop through, grab the first call using &limit=500, if you get less than 500 then you have all the records. If your model is not in the first group, check the count parameter and then loop through grabbing a new result using the &offset= and a limit of 500 until you either find the model or hit the end and say they ain't there

Good luck.
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-27-2024, 03:03 AM   #6
natkejs
Confirmed User
 
Industry Role:
Join Date: Jan 2003
Location: Nomad Land
Posts: 1,554
Fetch her cam URL and check if she's online that way.
Cache the results for 2 minutes at a time or something like that.

Should be way more efficient than pulling their entire feed just to see if one individual model is online.
__________________
natkejs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-27-2024, 06:21 AM   #7
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 54,546
you could fetch the html of the model page and check for the status.

methods

1. regex
2. simplehtmldom
3. didom (which i like)
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


my contact: fris at fris.net
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-27-2024, 08:13 AM   #8
Darkhorse
Horsing Around
 
Darkhorse's Avatar
 
Industry Role:
Join Date: Sep 2002
Location: AU
Posts: 5,827
Quote:
Originally Posted by fris View Post
you could fetch the html of the model page and check for the status.

methods

1. regex
2. simplehtmldom
3. didom (which i like)
Something like this should work.

Code:
<?php
// Model URL to check
$url = "https://chaturbate.com/shinyways/";

// Create a new DOMDocument
$doc = new DOMDocument();

// Load the webpage content
@$doc->loadHTMLFile($url);

// Check if the model is online
$onlineElement = $doc->getElementById('room_subject');
if ($onlineElement !== null) {
    // Model is online
    echo "shinyways is online!";
} else {
    // Model is not online
    echo "shinyways is not online.";
}
?>
Darkhorse is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-30-2024, 09:36 AM   #9
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,544
Quote:
Originally Posted by natkejs View Post
Fetch her cam URL and check if she's online that way.
Cache the results for 2 minutes at a time or something like that.

Should be way more efficient than pulling their entire feed just to see if one individual model is online.
Quote:
Originally Posted by fris View Post
you could fetch the html of the model page and check for the status.

methods

1. regex
2. simplehtmldom
3. didom (which i like)
Quote:
Originally Posted by Darkhorse View Post
Something like this should work.

Code:
<?php
// Model URL to check
$url = "https://chaturbate.com/shinyways/";

// Create a new DOMDocument
$doc = new DOMDocument();

// Load the webpage content
@$doc->loadHTMLFile($url);

// Check if the model is online
$onlineElement = $doc->getElementById('room_subject');
if ($onlineElement !== null) {
    // Model is online
    echo "shinyways is online!";
} else {
    // Model is not online
    echo "shinyways is not online.";
}
?>
I don't think those will work as cleanly as you think. I could be wrong.

The curl option will definitely hit the the 18 and over warning page and you really can't interact with that through curl.

I believe the domdocument and the simplehtml method will hit the same thing. I can't accurately test right now because allow_url_fopen() is turned off on my server.

You could use a headless browser and negotiate with the page that way.

Thus, I think iterating through the results is a valid solution.
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-30-2024, 10:07 AM   #10
fuzebox
making it rain
 
fuzebox's Avatar
 
Industry Role:
Join Date: Oct 2003
Location: seattle
Posts: 21,685
Quote:
Originally Posted by sarettah View Post
I don't think those will work as cleanly as you think. I could be wrong.

The curl option will definitely hit the the 18 and over warning page and you really can't interact with that through curl.

I believe the domdocument and the simplehtml method will hit the same thing. I can't accurately test right now because allow_url_fopen() is turned off on my server.

You could use a headless browser and negotiate with the page that way.

Thus, I think iterating through the results is a valid solution.
Sarettah is correct, Chaturbate will 403 any requests with javascript disabled.
fuzebox is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-30-2024, 10:39 AM   #11
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,544
Another option, if you want to avoid the iteration solution would be to pull the version 1 api every couple of minutes and store it on the server

Then whenever you want to see if the model is online you just check inside the file to see if she is there, you can use a simple substr_count() to test if the model name is in there.

The pull of the version 1 gets all models on line so you pull it via cron to load into your file, on my server it takes about 1 second to pull.
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-30-2024, 07:21 PM   #12
natkejs
Confirmed User
 
Industry Role:
Join Date: Jan 2003
Location: Nomad Land
Posts: 1,554
Quote:
Originally Posted by sarettah View Post
I don't think those will work as cleanly as you think. I could be wrong.

The curl option will definitely hit the the 18 and over warning page and you really can't interact with that through curl.

I believe the domdocument and the simplehtml method will hit the same thing. I can't accurately test right now because allow_url_fopen() is turned off on my server.

You could use a headless browser and negotiate with the page that way.

Thus, I think iterating through the results is a valid solution.
Quote:
Originally Posted by sarettah View Post
Another option, if you want to avoid the iteration solution would be to pull the version 1 api every couple of minutes and store it on the server

Then whenever you want to see if the model is online you just check inside the file to see if she is there, you can use a simple substr_count() to test if the model name is in there.

The pull of the version 1 gets all models on line so you pull it via cron to load into your file, on my server it takes about 1 second to pull.
I do not disagree with your solution as it would let you check any amount of online statuses from just one API call. However, calling individual model pages works just fine, the age restriction is simply an overlay.

Quote:
Originally Posted by fuzebox View Post
Sarettah is correct, Chaturbate will 403 any requests with javascript disabled.
This is incorrect as they would have no idea whether the client has javascript enabled or not on the first request.
__________________
natkejs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-30-2024, 09:15 PM   #13
fuzebox
making it rain
 
fuzebox's Avatar
 
Industry Role:
Join Date: Oct 2003
Location: seattle
Posts: 21,685
Quote:
Originally Posted by natkejs View Post
This is incorrect as they would have no idea whether the client has javascript enabled or not on the first request.
I admit I just checked quickly with curl and didn't see an obvious way past the first javascript cookie set and redirect.
fuzebox is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-01-2024, 05:49 PM   #14
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,544
I stand corrected also. I had done a quick curl pull and stopped looking through the page at the 18 year old stuff. It does appear that the actual page appears underneath. So a curl solution could probably work.
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks

Tags
online, shinyways, models, details, including, bunch, array, username=shinyways, huge, check, middle, hidden, wrong, explain, api, curl, returns, model, chaturbate, entry, return



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.