Envs

  • python 3.9.x
  • bard-api 0.1.4

1️⃣

{'content': 'Response Error: b\')]}\\\'\\n\\n38\\n[["wrb.fr",null,null,null,null,[9]]]\\n54\\n[["di",82],["af.httprm",82,"5948628323670192505",4]]\\n25\\n[["e",4,null,null,129]]\\n\'.'} 

2️⃣

Bard-API/bardapi/core.py", line 32, in _get_snim0e return re.search(r"SNlM0e":"(.*?)"", resp.text).group(1) AttributeError: 'NoneType' object has no attribute 'group'

3️⃣

SNlM0e value not found in response. Check __Secure-1PSID value.

Solution

  1. __Secure-1PSID 값 다시 확인
    • __Secure-1PSID values ​​end with single a dot.
  2. https://bard.google.com/ 들어가서 최소 1개의 대화를 진행 후, __Secure-1PSID 붙여넣기
  3. 🍪 Browser 쿠키 모두 삭제 후 API Key 붙여넣기
  4. 🔻 bard-api package version downgrade
    • Meet the needs that required version pip install bardapi==0.1.3
  5. All required packages install
from bardapi import Bard

response = Bard(timeout = 10).get_answer('현재 대한민국 대통령은 누구일까?')['content']
print(response)

>> 2023 5 31 현재 대한민국의 대통령은 윤석열입니다. 윤석열은 2022 3 9 제20대 대통령 선거에서 48.56% 득표율로 당선되었습니다. 그는 2022 5 10 취임하여 현재까지 재임 중입니다.

Ref.