@@ -19,25 +19,57 @@ function handleWithDelay<T>(delayProcess: number = 500, dataSet: Array<any>, han
1919 return outData . values
2020}
2121
22- // let userMedia = user.search('luna2d').then(tempUser => user.userMedia(tempUser.id))
23- // userMedia.then(tempMedia => console.log(tempMedia[0]))
24- // let account = user
25- // user.account().then((account:any) => user.getAccount(account.id)).then(console.log)
22+ let userMedia = user . search ( 'luna2d' ) . then ( tempUser => user . userMedia ( tempUser . id ) )
23+ userMedia . then ( tempMedia => tempMedia . forEach ( ( media : any ) => IGService . getEventEmiter ( ) . emit ( "media" , media ) ) )
24+ let account = user . account ( ) . then ( ( account : any ) =>
25+ user . getAccount ( account . id ) . then ( account => IGService . getEventEmiter ( ) . emit ( "media" , account ) )
26+ )
2627
2728
2829let followers = user . search ( "luna2d" )
2930 . then ( ( account : any ) => user . getUserFollowers ( account . id ) )
31+
32+ followers . then ( ( accounts : Array < any > ) =>
33+ accounts . forEach ( account => IGService . getEventEmiter ( ) . emit ( "user" , account ) )
34+ )
35+
36+
37+
38+
39+ let fullFollwers = followers
40+ . then ( ( accounts : Array < any > ) => handleWithDelay ( 2000 , accounts . map ( _ => _ . id ) , user . getAccount ) )
41+
42+ fullFollwers . then ( array => array . forEach ( element => {
43+ element . then ( ( account : any ) => account . _params ) . then ( ( value : any ) => IGService . getEventEmiter ( ) . emit ( "user" , value ) )
44+
45+ } ) )
46+
47+
3048// let fullFollwers = followers
3149// .then((accounts: Array<any>) => Promise.all(accounts.map(account => user.getAccount(account.id))))
3250// followers.then(_ => console.log(_.length))
3351// console.log(user.getAccount)
34-
3552// fullFollwers.then(value => console.log("all has been Processed" + value.length))
3653
3754
3855
3956let following = user . account ( )
4057 . then ( ( account : any ) => user . getUserFollowing ( account . id ) )
58+
59+ following . then ( ( accounts : Array < any > ) =>
60+ accounts . forEach ( account => IGService . getEventEmiter ( ) . emit ( "user" , account ) )
61+ )
62+
63+
64+
65+
66+ let fullFollowin = following
67+ . then ( ( accounts : Array < any > ) => handleWithDelay ( 2000 , accounts . map ( _ => _ . id ) , user . getAccount ) )
68+
69+ fullFollowin . then ( array => array . forEach ( element => {
70+ element . then ( ( account : any ) => account . _params ) . then ( ( value : any ) => IGService . getEventEmiter ( ) . emit ( "user" , value ) )
71+
72+ } ) )
4173// let fullFollowin = following
4274// .then((accounts: Array<any>) => Promise.all(accounts.map(account => user.getAccount(account.id))))
4375
@@ -47,4 +79,36 @@ let following = user.account()
4779// let mediaLikers = userMedia.map((_: any) => _.id)
4880// .then((ids: Array<any>) => Promise.all(ids.map(id => media.getMediaLikersHandler(id))))
4981
50- // followers.then((dataSet => dataSet.slice(2))).then(console.log)
82+ // followers.then((dataSet => dataSet.slice(2))).then(console.log)
83+
84+
85+
86+
87+
88+
89+ let mediaComments = userMedia . map ( ( _ : any ) => _ . id )
90+ . then ( ( ids : Array < any > ) => Promise . all ( ids . map ( id => media . getMediaCommentsHandler ( id ) ) ) )
91+
92+ let mediaLikers = userMedia . map ( ( _ : any ) => _ . id )
93+ . then ( ( ids : Array < any > ) => Promise . all ( ids . map ( id => media . getMediaLikersHandler ( id ) ) ) )
94+
95+ followers . then ( ( dataSet => dataSet . slice ( 2 ) ) ) . then ( console . log )
96+ let keyMedia = "media"
97+ IGService . getEventEmiter ( ) . on ( keyMedia , ( data :any ) => {
98+ IGService . dataStorage ( { } , data , keyMedia )
99+ } )
100+ let keyUser = "user"
101+ IGService . getEventEmiter ( ) . on ( keyUser , ( data :any ) => {
102+ IGService . dataStorage ( { } , data , keyUser )
103+
104+ } )
105+ let keyFollowing = "following"
106+ IGService . getEventEmiter ( ) . on ( keyFollowing , ( data :any ) => {
107+ IGService . dataStorage ( { } , data , keyFollowing )
108+
109+ } )
110+ let keyFollower = "follower"
111+ IGService . getEventEmiter ( ) . on ( keyFollowing , ( data :any ) => {
112+ IGService . dataStorage ( { } , data , keyFollower )
113+
114+ } )
0 commit comments