-
Notifications
You must be signed in to change notification settings - Fork 0
/
profile.html
140 lines (127 loc) · 4.83 KB
/
profile.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<!DOCTYPE html>
<html>
<head>
<title>Instragram Scrape Dailykalakaar</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css" />
</head>
<body>
<style>
.posts {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
flex-wrap: wrap;
}
.like-comment {
font-size: 10px;
color: #333;
padding-bottom: 40px;
font-weight: bold;
}
</style>
<div class="container" style="margin-top:20px;margin-bottom:20px;padding:50px;background-color:#ddd;">
<div class="row">
<div class="col-md-3">
<img src="" class="profile-pic" style="border-radius:50%;">
</div>
<div class="col-md-9">
<h2 class="username"></h2>
<div class="row">
<div class="col-md-4">
<span class="number-of-posts"></span> posts
</div>
<div class="col-md-4">
<span class="followers"></span> followers
</div>
<div class="col-md-4">
<span class="following"></span> following
</div>
</div>
<div class="row" style="margin-top:60px;">
<h4 class="name"></h4>
</div>
<div class="row">
<h4 class="biography"></h4>
</div>
<br>
<hr>
<br>
<div class="row">
<p>POSTS</p>
</div>
<div class="row posts"></div>
</div>
</div>
<div class="text-center">
<table class="table table-hover">
<thead>
<tr>
<th>Rank</th>
<th>Photo</th>
<th>Stats</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
function nFormatter(num) {
if (num >= 1000000000) {
return (num / 1000000000).toFixed(1).replace(/\.0$/, '') + 'G';
}
if (num >= 1000000) {
return (num / 1000000).toFixed(1).replace(/\.0$/, '') + 'M';
}
if (num >= 1000) {
return (num / 1000).toFixed(1).replace(/\.0$/, '') + 'K';
}
return num;
}
$.ajax({
url: "https://www.instagram.com/dailykalakaar?__a=1",
type: 'get',
success: function(response) {
$(".profile-pic").attr('src', response.graphql.user.profile_pic_url);
$(".name").html(response.graphql.user.full_name);
$(".biography").html(response.graphql.user.biography);
$(".username").html(response.graphql.user.username);
$(".number-of-posts").html(response.graphql.user.edge_owner_to_timeline_media.count);
$(".followers").html(nFormatter(response.graphql.user.edge_followed_by.count));
$(".following").html(nFormatter(response.graphql.user.edge_follow.count));
}
})
var COUNT = 80;
$.ajax({
url: 'https://phantombuster.s3.amazonaws.com/03DvROEbl1Y/AHT946taukyvYPweJS4aAg/dailykalakaar_posts.json',
type: "get",
success: function(response) {
console.log(response);
posts = response.sort(function(a, b) {
return b.likeCount - a.likeCount;
});
posts_html = '';
for (var i = 0; i < posts.length; i++) {
// url = posts[i].node.display_url;
comments = posts[i]["commentCount"]
likes = posts[i]["likeCount"]
posts_html += '<tr>\
<td>' + (i + 1) + '</td>\
<td class="text-center">\
<a href="' + posts[i]["postUrl"] + '" target="_blank"><img style="" width="100" class="img-fluid" src="' + posts[i]["imgUrl"] + '"></a>\
</td> \
<td>\
' + nFormatter(likes) + ' LIKES <br>' + nFormatter(comments) + ' COMMENTS\
</td>\
</tr>';
}
$("tbody").append(posts_html);
}
})
});
</script>
</body>