본문 바로가기

카테고리 없음

비공식적인 Bard Api사용하기

Python코드로 아래와 같이 작성하면 된다  

쿠키값은 각각 아래와 같이 찾으면 된다 

  • F12 > Applications > Cookies > bard > __Secure-1PSID, __Secure-1PSIDTS
from bardapi import BardCookies

def getbard():
    cookie_dict = {
    "__Secure-1PSID": "xxx",
    "__Secure-1PSIDTS": "xxx",}
 
    bard = BardCookies(cookie_dict=cookie_dict)
    print(bard.get_answer("양자역학에 대해 간단하게 알려줘")['content'])
    # getbard 함수의 내용을 구현해주세요.

def main():
    # main 함수 내부에서 getbard 함수를 호출합니다.
    getbard()

if __name__ == "__main__":
    main()