![]() |
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. |
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. |
Quote:
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"? |
Quote:
you will want the seconds_online value in the array. |
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. ®ion=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. |
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. |
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:
Code:
<?php |
Quote:
Quote:
Quote:
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:
|
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. |
Quote:
Quote:
Quote:
|
Quote:
|
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 10:47 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc