小编Kol*_*nko的帖子

使用python登录Instagram

我正在尝试登录 instagram。这是我的代码

from bs4 import BeautifulSoup
from requests import *
payload = {
    'action': 'login',
    'username': 'name',
    'password': 'pass'
}

with session() as c:
    c.post('https://www.instagram.com/login.php', data=payload)
    response = c.get('https://www.instagram.com/accounts/edit/')
    print(response.headers)
    print(response.text)
Run Code Online (Sandbox Code Playgroud)

不幸的是,它似乎没有让我登录。我得到:

lt-ie8 lt-ie7 not-logged-in client-root
Run Code Online (Sandbox Code Playgroud)

任何解决方案将不胜感激。谢谢。

python login beautifulsoup instagram web

6
推荐指数
1
解决办法
2万
查看次数

向下滚动列表 instagram selenium 和 python

我为 Instagram 写了一个脚本。我需要一个方法来返回一个关注者列表。我的关注者不可见(只有 10 个),我必须向下滚动页面。我正在使用 selenium webdriver 和 python 来自动化这个过程。但不幸的是它没有向下滚动。这是我的代码

    def get_followers(self):
    try:
        driver.find_elements_by_css_selector('a._t98z6')[0].click()
    except Exception as e:
        print("Sorry, i don't have access to your followers: {0}".format(e))
    else:
    followers = []
                while True:
            driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")
            try:
                WebDriverWait(driver, 20).until(lambda x: x.find_element_by_css_selector("li._6e4x5"))
            except:
                break
        followers = driver.find_elements_by_css_selector("a._2g7d5.notranslate._o5iw8")

     return followers
Run Code Online (Sandbox Code Playgroud)

任何解决方案将不胜感激。谢谢。

python selenium scroll list instagram

2
推荐指数
1
解决办法
5742
查看次数

标签 统计

instagram ×2

python ×2

beautifulsoup ×1

list ×1

login ×1

scroll ×1

selenium ×1

web ×1