如何将自动取消关注模块添加到以下代码?

How to add auto unfollow module to the fallowing code?

这是一个 python 代码并列出我只关注他们的用户。我想通过添加一个自动取消关注的模块来使用相同的列表:

。 . .

def get_unfollowers(browser):
    """
    Opens the profile, obtains the follower and following list
    Returns the names of the users who are in the following list, but not in the follower list
    """
    to_profile = browser.find_element_by_xpath("//a[contains(@href, '/{}')]".format(username))
    to_profile.click()
    sleep(3)
    to_following = browser.find_element_by_xpath("//a[contains(@href, '/following')]")
    to_following.click()
    following_list = get_name(browser)
    to_followers = browser.find_element_by_xpath("//a[contains(@href, '/followers')]")
    to_followers.click()
    followers_list = get_name(browser)
    not_following_back = [user for user in following_list if user not in followers_list]

    print(not_following_back)  # prints a list with every name separated by a comma
 


def get_name(browser):

    sleep(2)
    scroll_box = browser.find_element_by_class_name('isgrP')
    p_height, height = 0, 1
    while p_height != height:
        p_height = height
        sleep(2)
        height = browser.execute_script(
            "arguments[0].scrollTo(0, arguments[0].scrollHeight); return arguments[0].scrollHeight;", scroll_box)
    total_list = scroll_box.find_elements_by_tag_name('li')
    names = [name.text for name in total_list if name.text != '']
    close_dub = browser.find_element_by_xpath("/html/body/div[4]/div/div/div[1]/div/div[2]/button")
    close_dub.click()
    return names



get_unfollowers(browser)

这是我编写并用于取消关注我想要的列表的代码

def do_unfolow(列表): 对于列表中的 x: 打印(x) browser.get('https://www.instagram.com/'+x)

    # tempy2 = browser.find_element_by_css_selector(".vBF20._1OSdk")
     #if not tempy2:
     tempy2 = browser.find_element_by_css_selector(".glyphsSpriteFriend_Follow")
     #tempy2 = browser.find_element_by_css_selector("Igw0E.rBNOH.YBx95._4EzTm")
     tempy2.click()
     tempy2 = browser.find_element_by_xpath("//button[contains(text(), 'Unfollow')]")
     tempy2.click()
     sleep(10)