我用python编写了一个脚本,它的作用是检查Elon Musks twitter上的新tweet,然后将其保存到列表1、2、3中的文本文件中
我现在想制作另一个脚本,它也使用文本文件,它比较文本文件1和文本文件2。如果新文本文件没有与文件1相同的最新tweet,它会将其发送到Telegrame,并将其保存到自己的文件中。目前,我对第二个脚本的所有内容是
import requests
def telegram_bot_sendtext(bot_message):
bot_token = 'xxx'
bot_chatID = 'xxx'
send_text = 'https://api.telegram.org/bot' + bot_token + '/sendMessage?chat_id=' + bot_chatID + '&parse_mode=Markdown&text=' + bot_message
response = requests.get(send_text)
return response.json()
test = telegram_bot_sendtext("Testing Telegram bot")
print(test)
只是基本的hello world教程。我以为会有一个youtube视频我可以找到像这样的东西,也许它没有我想的那么简单--(o.o)——
我对编程非常陌生,认为这将是数据分析的一个有趣的开始。感谢您的帮助
编辑:另一个代码是
import requests
import twint
c = twint.Config()
c.Limit = 20
c.Username = "elonmusk"
c.Pandas = True
twint.run.Search(c)
Tweets_df = twint.storage.panda.Tweets_df
目前没有回答
相关问题 更多 >
编程相关推荐