Skip to content

Instantly share code, notes, and snippets.

@jokereven
Created August 12, 2023 08:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jokereven/ef4b376099d9cc96bb187cc8922b52af to your computer and use it in GitHub Desktop.
Save jokereven/ef4b376099d9cc96bb187cc8922b52af to your computer and use it in GitHub Desktop.
Catchmint_Little_Love
from dotenv import load_dotenv
from xiaoaitts import XiaoAi
import threading
import requests
import time
import os
class fm(object):
def __init__(self, user, passwd):
client = XiaoAi(user, passwd)
self.client = client
def broadcast(self, msg):
self.client.say(msg)
def get_data(self):
while True: # This loop will keep running indefinitely
url = 'https://api.catchmint.xyz/timeseries/mints/overview/?window=60&chains=ethereum'
response = requests.get(url)
if response.status_code == 200:
data = response.json()
print('response: {}', response)
threads = []
for item in data:
name = item.get('name', '')
totalCounts = item.get('totalCounts', 0)
if totalCounts > 50:
msg = '{} 有 {} 个 NFT 被创造'.format(name, totalCounts)
print('msg: {}'.format(msg))
t = threading.Thread(target=self.broadcast, args=(msg,))
threads.append(t)
t.start()
time.sleep(8)
for t in threads:
t.join()
else:
print('get_data failed with status code: {}'.format(response.status_code))
time.sleep(15) # Wait for 15 seconds before making the next API request
if __name__ == '__main__':
load_dotenv()
user = os.environ['user']
passwd = os.environ['passwd']
fm_instance = fm(user, passwd)
fm_instance.get_data()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment