Hello. I'm asking you a question because I'm stuck while studying Twitter crawl on Python.
I thought the problem would be solved quickly because it was very simple, but I can't think of a solution.
//
import GetOldTweets3 as got
from bs4 import BeautifulSoup as bs
import datetime
import time
sweetCriteria = got.manager.TweetCriteria().setQuerySearch('Lunch Today')\
.setSince("2020-01-01")\
.setUntil("2020-05-13")\
.setMaxTweets(100)
tweet = got.manager.TweetManager.getTweets(tweetCriteria)[0]
print(tweet.text)
It's a twitter crawl code.
tweet = got.manager.TweetManager.getTweets(tweetCriteria)[0] In this part, I want to extract [0] from the range of 0 to 24, but I'm not sure how to use the repetition.
I've tried this before
//import GetOldTweets3 as got
from bs4 import BeautifulSoup as bs
import datetime
import time
sweetCriteria = got.manager.TweetCriteria().setQuerySearch('Gift Kakao Talk')\
.setSince("2020-01-01")\
.setUntil("2020-05-13")\
.setMaxTweets(100)
for i in range(0,24):
print(i)
tweet = got.manager.TweetManager.getTweets(tweetCriteria)[i]
print(tweet.text)
There are many other things besides this, but of course, it only comes from 0 to 24 and no text comes out.
How do we code to solve this?
python loops
from bs4 import BeautifulSoup as bs
import datetime
import time
sweetCriteria = got.manager.TweetCriteria().setQuerySearch('Gift Kakao Talk')\
.setSince("2020-01-01")\
.setUntil("2020-05-13")\
.setMaxTweets(100)
for i in range(0,24):
tweet = got.manager.TweetManager.getTweets(tweetCriteria)[i]
print(tweet.text)
© 2024 OneMinuteCode. All rights reserved.