Note
트위터 api 활용 tweet 가져오기 본문
728x90
!pip install tweepy
# 개발자 계정으로 받은 토큰 입력
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""
import tweepy
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
# 검색하고 싶은 키워드
keyword = ""
# 결과 담을 리스트
result = []
# 트윗 가져오기
tweets = api.search(q = keyword, result_type = 'recent', count = 30)
# 트윗 게시물 id, 내용, 날짜 가져오기
for tweet in tweets:
result.append([tweet.id_str,tweet.text,tweet.created_at])
'etc > Crawling' 카테고리의 다른 글
Youtube 스크립트(2) (0) | 2023.04.07 |
---|---|
Youtube 스크립트 (0) | 2023.03.23 |
유튜브 커뮤니티 텍스트 크롤링 (0) | 2022.08.18 |
인스타그램 크롤링 (9) - 계정 팔로우, 팔로워, 게시글 (0) | 2022.07.14 |
인스타그램 크롤링 (8) - 사진 정보 크롤링 (0) | 2022.07.13 |