forked from MRHRTZ/Js-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathig-user.js
67 lines (63 loc) · 2.99 KB
/
ig-user.js
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
const get = require('got')
function getUser(username) {
return new Promise((resolve, reject) => {
get.get('https://www.instagram.com/' + username + '/?__a=1').then(a => {
const user = JSON.parse(a.body).graphql.user
// console.log(user.biography)
resolve({
// link: URL.replace('/?__a=1', ''),
id: user.id,
biography: user.biography,
subscribersCount: user.edge_followed_by.count,
subscribtions: user.edge_follow.count,
fullName: user.full_name,
highlightCount: user.highlight_reel_count,
isBusinessAccount: user.is_business_account,
isRecentUser: user.is_joined_recently,
accountCategory: user.business_category_name,
linkedFacebookPage: user.connected_fb_page,
isPrivate: user.is_private,
isVerified: user.is_verified,
profilePic: user.profile_pic_url,
profilePicHD: user.profile_pic_url_hd,
username: user.username,
postsCount: user.edge_owner_to_timeline_media.count,
posts: user.edge_owner_to_timeline_media.edges.map(edge => {
let hasCaption = edge.node.edge_media_to_caption.edges[0];
return {
id: edge.node.id,
shortCode: edge.node.shortcode,
url: `https://www.instagram.com/p/${edge.node.shortcode}/`,
dimensions: edge.node.dimensions,
imageUrl: edge.node.display_url,
isVideo: edge.node.is_video,
caption: hasCaption ? hasCaption.node.text : '',
commentsCount: edge.node.edge_media_to_comment.count,
commentsDisabled: edge.node.comments_disabled,
timestamp: edge.node.taken_at_timestamp,
likesCount: edge.node.edge_liked_by.count,
location: edge.node.location,
children: edge.node.edge_sidecar_to_children ? edge.node.edge_sidecar_to_children.edges.map(edge => {
return {
id: edge.node.id,
shortCode: edge.node.shortcode,
dimensions: edge.node.dimensions,
imageUrl: edge.node.display_url,
isVideo: edge.node.is_video,
}
}) : []
}
}) || []
});
})
})
}
let arrBln = ["Januari","Februaru","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"]
let a = new Date(1606475029 * 1000)
const jam = a.getHours()
const menit = a.getMinutes()
const bulan = a.getMonth()
const tanggal = a.getDate()
const tahun = a.getFullYear()
console.log(jam, menit, arrBln[bulan - 1], tanggal, tahun)
getUser('mariaeka_').then((a) => console.log(a))