Skip to content Skip to sidebar Skip to footer

How To Pull Data From Another Website Using Javascript Or Jquery (cross-domain) Cors (no Api)

The goal is to get the total number of members in the telegram group. This number has a unique css identifier and should be able to get pulled via jsoup or another method.. Using t

Solution 1:

I think this is the right code to be using, however it just does not pull the number of members as needed. It bypasses the CORS however I don't know how to select the right css for the members so nothing is happening...

<scriptsrc="https://code.jquery.com/jquery-1.9.1.min.js"></script><scripttype="text/javascript">varExternalURL = "tgstat.com/en/channel/@addStickers"; // This address must not contain any leading "http://"varContentLocationInDOM = ".columns.large-2.medium-4.small-6.margin-bottom15 > div > .align-center > #text"; // If you're trying to get sub-content from the page, specify the "CSS style" jQuery syntax here, otherwise set this to "null"

    $(document).ready(loadContent);
   functionloadContent()
   {
      varQueryURL = "https://api.codetabs.com/v1/proxy/?quest=" + ExternalURL;
      $.getJSON(QueryURL, function(data){
         if (data && data != null && typeof data == "object" && data.contents && data.contents != null && typeof data.contents == "string")
         {
            data = data.contents.replace();
            if (data.length > 0)
            {
               if (ContentLocationInDOM && ContentLocationInDOM != null && ContentLocationInDOM != "null")
               {
                  $('#telegramMembers').html($(ContentLocationInDOM, data));
               }
               else
               {
                  $('#telegramMembers').html(data);
               }
            }
         }
      });
   }
</script>

any suggestions would be helpful.

Post a Comment for "How To Pull Data From Another Website Using Javascript Or Jquery (cross-domain) Cors (no Api)"