Chaturbate API for online models.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Akali
    So Fucking Banned
    • Apr 2023
    • 83

    #1

    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...nyways&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
    Too lazy to set a custom title
    • Aug 2002
    • 55705

    #2
    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.

    Comment

    • Akali
      So Fucking Banned
      • Apr 2023
      • 83

      #3
      Originally posted by fris
      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"?

      Comment

      • fris
        Too lazy to set a custom title
        • Aug 2002
        • 55705

        #4
        Originally posted by Akali
        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.

        Comment

        • sarettah
          see you later, I'm gone
          • Oct 2002
          • 14327

          #5
          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.
          All cookies cleared!

          Comment

          • natkejs
            Confirmed User
            • Jan 2003
            • 1640

            #6
            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.

            Comment

            • fris
              Too lazy to set a custom title
              • Aug 2002
              • 55705

              #7
              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.

              Comment

              • Darkhorse
                Horsing Around
                • Sep 2002
                • 5879

                #8
                Originally posted by fris
                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.";
                }
                ?>

                Comment

                • sarettah
                  see you later, I'm gone
                  • Oct 2002
                  • 14327

                  #9
                  Originally posted by natkejs
                  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.
                  Originally posted by fris
                  you could fetch the html of the model page and check for the status.

                  methods

                  1. regex
                  2. simplehtmldom
                  3. didom (which i like)
                  Originally posted by Darkhorse
                  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.
                  All cookies cleared!

                  Comment

                  • fuzebox
                    making it rain
                    • Oct 2003
                    • 22353

                    #10
                    Originally posted by sarettah
                    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.

                    Comment

                    • sarettah
                      see you later, I'm gone
                      • Oct 2002
                      • 14327

                      #11
                      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.
                      All cookies cleared!

                      Comment

                      • natkejs
                        Confirmed User
                        • Jan 2003
                        • 1640

                        #12
                        Originally posted by sarettah
                        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.
                        Originally posted by sarettah
                        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.

                        Originally posted by fuzebox
                        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.

                        Comment

                        • fuzebox
                          making it rain
                          • Oct 2003
                          • 22353

                          #13
                          Originally posted by natkejs
                          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.

                          Comment

                          • sarettah
                            see you later, I'm gone
                            • Oct 2002
                            • 14327

                            #14
                            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 cookies cleared!

                            Comment

                            Working...