instatag/instatag.py
def step_2_gen(name_list,tag):
    '''
    This function extract 2nd users (from 1st users follower and following list)
    :param name_list: 1st users id
    :param tag: hashtag
    :type name:list
    :type tag:str
    :return: None
    '''
    try:
        file=io.open("insta_data/users_2_"+tag+".txt","a",encoding="utf-8")
        user_list=[]
        for i in range(len(name_list)):
            print("ID : "+name_list[i])
            user_url=step_2_url_maker(name_list[i])
            raw_html=get_html(user_url,max_delay=8)
            raw_file = BeautifulSoup(raw_html, "html.parser").prettify()
            if raw_file.find('"more_available": false')!=-1:
                print("Account is private")
                continue
            index=0
            while (index != -1):
                index = raw_file.find('"username":', index + 13, len(raw_file))
                length = raw_file[index:].find('}')
                user = raw_file[index + 13:index + length - 1]
                if user[-1] == '"':
                    user = user[:-1]
                user = user.encode("utf-8")
                if len(user) < 50 and user not in user_list and user!=name_list[i]:
                    file.write(str(user, encoding="utf-8") + "\n")
                    user_list.append(user)
            print(str(len(user_list))+" ID Extracted")
    except Exception as ex:
        print(str(ex))

    This function extract 2nd users (from 1st users follower and following list)
    :param name_list: 1st users id
    :param tag: hashtag
    :type name:list
    :type tag:str
    :return: None
    
This function extract 2nd users (from 1st users follower and following list)
This function extract 2nd users ( from 1st users follower and following list )
def step_2_gen(name_list,tag):
    try:
        file=io.open("insta_data/users_2_"+tag+".txt","a",encoding="utf-8")
        user_list=[]
        for i in range(len(name_list)):
            print("ID : "+name_list[i])
            user_url=step_2_url_maker(name_list[i])
            raw_html=get_html(user_url,max_delay=8)
            raw_file = BeautifulSoup(raw_html, "html.parser").prettify()
            if raw_file.find('"more_available": false')!=-1:
                print("Account is private")
                continue
            index=0
            while (index != -1):
                index = raw_file.find('"username":', index + 13, len(raw_file))
                length = raw_file[index:].find('}')
                user = raw_file[index + 13:index + length - 1]
                if user[-1] == '"':
                    user = user[:-1]
                user = user.encode("utf-8")
                if len(user) < 50 and user not in user_list and user!=name_list[i]:
                    file.write(str(user, encoding="utf-8") + "\n")
                    user_list.append(user)
            print(str(len(user_list))+" ID Extracted")
    except Exception as ex:
        print(str(ex))
def step_2_gen ( name_list , tag ) : try : file = io . open ( "insta_data/users_2_" + tag + ".txt" , "a" , encoding = "utf-8" ) user_list = [ ] for i in range ( len ( name_list ) ) : print ( "ID : " + name_list [ i ] ) user_url = step_2_url_maker ( name_list [ i ] ) raw_html = get_html ( user_url , max_delay = 8 ) raw_file = BeautifulSoup ( raw_html , "html.parser" ) . prettify ( ) if raw_file . find ( '"more_available": false' ) != - 1 : print ( "Account is private" ) continue index = 0 while ( index != - 1 ) : index = raw_file . find ( '"username":' , index + 13 , len ( raw_file ) ) length = raw_file [ index : ] . find ( '}' ) user = raw_file [ index + 13 : index + length - 1 ] if user [ - 1 ] == '"' : user = user [ : - 1 ] user = user . encode ( "utf-8" ) if len ( user ) < 50 and user not in user_list and user != name_list [ i ] : file . write ( str ( user , encoding = "utf-8" ) + "\n" ) user_list . append ( user ) print ( str ( len ( user_list ) ) + " ID Extracted" ) except Exception as ex : print ( str ( ex ) )
This function extract 2nd users (from 1st users follower and following list)
This function extract 2nd users ( from 1st users follower and following list )
'''
    This function extract 2nd users (from 1st users follower and following list)
    :param name_list: 1st users id
    :param tag: hashtag
    :type name:list
    :type tag:str
    :return: None
    '''
None
name_list
1st users id
1st users id
tag
None