instagram unfollowers
1.0.0
인스 타 그램에서 당신을 다시 따르지 않은 사람을 확인하는 가장 쉬운 방법은 정확한 추종자 수를 추적하여 수동으로 수행하는 것입니다. 팔로어 수가 줄어든 경우 특정 사용자의 "다음"목록을 조사하여 여전히 귀하를 따르고 있는지 여부를 확인할 수 있습니다.
이것은 분명히 시간이 많이 걸리고 실용적이지 않은 작업입니다. 특히 정기적으로 변동하는 추종자가 많을 때. 이제 부터이 스크립트를 사용하여 누가 당신을 따라 가지 못했는지 확인할 수 있습니다!
const sleep = milliseconds => new Promise ( resolve => setTimeout ( resolve , milliseconds ) ) ; async function handleOutput ( type , data ) { const styles = ` padding: 0.5rem 0; font-size: 1rem; font-weight: 700; ` ; const getMinutes = ( ) => { const steps = Math . floor ( ( data . followingCount - data . currentPageCount ) / data . estimatedStepValue ) ; const seconds = steps * 3 + Math . floor ( steps / 5 * 15 ) ; const minutes = Math . floor ( seconds / 60 ) ; if ( minutes <= 1 ) return "1 minute" ; else return ` ${ minutes } minutes` ; } ; if ( type === "PROGRESS" ) { console . clear ( ) ; console . warn ( `%cProgress ${ data . currentPageCount } / ${ data . followingCount } ( ${ parseInt ( data . currentPageCount / data . followingCount * 100 ) } %) - ETA: ${ getMinutes ( ) } ` , styles ) ; } else if ( type === "RATE_LIMIT" ) { console . clear ( ) ; console . warn ( "%cRATE LIMIT: Waiting 15 seconds before requesting again..." , styles ) ; await sleep ( 15000 ) ; } else if ( type === "FINISH" ) { console . clear ( ) ; if ( data . unfollowers . length === 0 ) return console . warn ( `%cPROCESS FINISHED - Everyone followed you back! ?` , styles ) ; console . group ( `%cPROCESS FINISHED - ${ data . unfollowers . length } ${ data . unfollowers . length === 1 ? "user" : "users" } didn't follow you back. ?` , styles ) ; data . unfollowers . forEach ( unfollower => console . log ( ` ${ unfollower . username } ${ unfollower . isVerified ? " ☑️" : "" } - https://www.instagram.com/ ${ unfollower . username } /` ) ) ; console . groupEnd ( ) ; } } ; class Script { constructor ( checkVerifiedUsers ) { this . checkVerifiedUsers = checkVerifiedUsers ; this . unfollowers = [ ] ; this . canQuery = false ; this . nextPageHash = "" ; this . requestsCount = 0 ; this . followingCount = 0 ; this . currentPageCount = 0 ; this . estimatedStepValue = 0 ; } getCookie ( cookieName ) { return new Promise ( ( resolve , reject ) => { const cookies = document . cookie . split ( ";" ) ; for ( const cookie of cookies ) { const pair = cookie . split ( "=" ) ; if ( pair [ 0 ] . trim ( ) === cookieName ) resolve ( decodeURIComponent ( pair [ 1 ] ) ) ; } reject ( "Cookie not found!" ) ; } ) ; } createURLParamsString ( params ) { return Object . keys ( params ) . map ( key => { const value = params [ key ] ; if ( typeof value === "object" ) return ` ${ key } = ${ JSON . stringify ( value ) } ` ; else return ` ${ key } = ${ value } ` ; } ) . join ( "&" ) ; } async generateURL ( ) { const params = { query_hash : "3dec7e2c57367ef3da3d987d89f9dbc8" , variables : { id : await this . getCookie ( "ds_user_id" ) , first : "1000" } } ; if ( this . nextPageHash ) params . variables . after = this . nextPageHash ; return `https://www.instagram.com/graphql/query/? ${ this . createURLParamsString ( params ) } ` ; } async startScript ( ) { try { do { if ( this . requestsCount !== 0 && this . requestsCount % 5 === 0 ) await handleOutput ( "RATE_LIMIT" ) ; const url = await this . generateURL ( ) ; const { data } = await fetch ( url ) . then ( res => res . json ( ) ) ; if ( checkVerifiedUsers ) { data . user . edge_follow . edges . forEach ( edge => { if ( ! edge . node . follows_viewer ) this . unfollowers . push ( { username : edge . node . username , isVerified : edge . node . is_verified } ) ; } ) ; } else { data . user . edge_follow . edges . forEach ( edge => { if ( ! edge . node . is_verified && ! edge . node . follows_viewer ) this . unfollowers . push ( { username : edge . node . username } ) ; } ) ; } this . canQuery = data . user . edge_follow . page_info . has_next_page ; this . nextPageHash = data . user . edge_follow . page_info . end_cursor ; this . requestsCount ++ ; this . followingCount = data . user . edge_follow . count ; this . currentPageCount += data . user . edge_follow . edges . length ; if ( this . estimatedStepValue === 0 ) this . estimatedStepValue = data . user . edge_follow . edges . length ; handleOutput ( "PROGRESS" , { currentPageCount : this . currentPageCount , estimatedStepValue : this . estimatedStepValue , followingCount : this . followingCount } ) ; await sleep ( 3000 ) ; } while ( this . canQuery ) ; handleOutput ( "FINISH" , { unfollowers : this . unfollowers } ) ; } catch ( error ) { return console . error ( `Something went wrong!n ${ error } ` ) ; } } } ; const checkVerifiedUsers = confirm ( "Do you want to check the verified users as well?" ) ; const script = new Script ( checkVerifiedUsers ) ; script . startScript ( ) ;
공헌은 오픈 소스 커뮤니티를 배우고, 영감을주고, 창조 할 수있는 놀라운 장소입니다. 당신이하는 모든 기여는 대단히 감사합니다. 이를 더 좋게 만드는 제안이 있다면 저장소를 포크하고 풀 요청을 작성하십시오. "Enhancement"태그에 문제를 열면 간단히 문제를 열 수도 있습니다.
프로젝트에 별을주는 것을 잊지 마십시오, 감사합니다! ?
MIT 라이센스에 따라 배포됩니다. 자세한 내용은 LICENSE.txt
참조하십시오.