In this blog we describe how you can get followers count from Facebook, Instagram, YouTube and Twitter profile URL.
When you enter a Facebook or Instagram URL in the text field and click on the button then contact information like; name, email, profile picture and description will also get from their social account.
For get followers we have to use some jQuery code snippets.
Facebook Follower count:
By using Facebook graph api you can get social count from Facebook. For this you require an access token and you can get this from here https://developers.facebook.com/docs/marketing-apis/overview/authentication/. After getting access token you can use jquery following code to get followers.
var link11 = document.getElementById('FacebookPageURL').value;
link11 = stipTrailingSlash(link11);
var link2 = link11.split( '/' );
var user = link2[link2.length - 1];
var token = 'Your Token';
$.ajax({
url: 'https://graph.facebook.com/'+user,
dataType: 'json',
type: 'GET',
data: {
access_token:token,
fields:'fan_count,name,about,emails,website,location'
},
success: function(data) {
console.log(JSON.stringify(data));
/*write your own code*/
}
});
Twitter Follower count:
For getting Twitter follower count we can use jQuery ajax call with the following PHP code. There is no access token required in this process.
jQuery Code:
var link11 = document.getElementById('TwitterURL').value;
link11 = stipTrailingSlash(link11);
var link2 = link11.split( '/' );
var twitter_user = link2[link2.length - 1];
$.ajax({
url: 'your php file path',
dataType: 'json',
type: 'GET',
data: {
user:twitter_user,
social_type:'twitter'
},
success: function(data) {
var followers = parseInt(data);
document.getElementById('TwitterReach').value = addCommas(followers);
}
});
PHP file code:
$user = $_GET['user'];
$data =file_get_contents("https://cdn.syndication.twimg.com/widgets/followbutton/info.json?screen_names=$user");
$data = json_decode($data, true);
echo isset($data[0]['followers_count']) ? $data[0]['followers_count'] : json_decode(false);
YouTube Follower count:
For YouTube we required an API Key to get followers. You can access this url https://rapidapi.com/blog/how-to-get-youtube-api-key/ for get api key. After that you can use the following code to get a follower count.
var link11 = document.getElementById('YouTubeChannelURL').value;
link11 = stipTrailingSlash(link11);
var link2 = link11.split( '/' );
var user = link2[link2.length - 1];
$.ajax({
url: 'https://www.googleapis.com/youtube/v3/channels',
dataType: 'jsonp',
type: 'GET',
data:{
part:'statistics',
id:user,
key: 'Your youtube key'
},
success: function(data) {
if(data.items && data.items !='undefined' && data.items.length != 0){
var subscribers = parseInt(data.items[0].statistics.subscriberCount);
document.getElementById('YouTubeReach').value = addCommas(subscribers);
}
});
Instagram Follower count:
For Instagram follower count we can go with jQuery InstagramFeed https://www.sowecms.com/demos/jquery.instagramFeed/index.html
By using this jQuery you can fetch Instagram Social Count and Instagram Photo Gallery as well.
By using the following code we can get follower count data.
<script type="text/javascript" src="jquery.instagramFeed.min.js"></script>
<script type="text/javascript">
(function($){
$(window).on('load', function(){
$.instagramFeed({
'username': 'instagram',
'callback': function(data){
$('#jsonHere').html(JSON.stringify(data, null, 2));
}
});
});
})(jQuery);
</script>
By using the above information you can get the social count of Instagram, Facebook, YouTube and Twitter.
It’s actually a great and helpful piece of information. I’m glad that you simply shared this useful information with us.
Please stay us informed like this. Thanks for sharing.
Here is my web blog maeng da kratom reviews (http://www.bellevuereporter.com)