GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Chaturbate API for online models. (https://gfy.com/showthread.php?t=1374981)

Akali 04-26-2024 05:47 PM

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.

fris 04-26-2024 06:57 PM

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.

Akali 04-26-2024 07:43 PM

Quote:

Originally Posted by fris (Post 23257893)
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"?

fris 04-26-2024 07:52 PM

Quote:

Originally Posted by Akali (Post 23257906)
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.

sarettah 04-26-2024 09:06 PM

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.

natkejs 04-27-2024 03:03 AM

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.

fris 04-27-2024 06:21 AM

you could fetch the html of the model page and check for the status.

methods

1. regex
2. simplehtmldom
3. didom (which i like)

Darkhorse 04-27-2024 08:13 AM

Quote:

Originally Posted by fris (Post 23257997)
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.";
}
?>


sarettah 04-30-2024 09:36 AM

Quote:

Originally Posted by natkejs (Post 23257958)
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 (Post 23257997)
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 (Post 23258017)
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.

fuzebox 04-30-2024 10:07 AM

Quote:

Originally Posted by sarettah (Post 23258950)
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.

sarettah 04-30-2024 10:39 AM

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.

natkejs 04-30-2024 07:21 PM

Quote:

Originally Posted by sarettah (Post 23258950)
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 (Post 23258977)
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 (Post 23258958)
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.

fuzebox 04-30-2024 09:15 PM

Quote:

Originally Posted by natkejs (Post 23259109)
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.

sarettah 05-01-2024 05:49 PM

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.


All times are GMT -7. The time now is 06:19 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc