|
|
@@ -16,9 +16,11 @@ from utils.utils_send_gotify import *
|
|
|
|
|
|
def get_chainalert():
|
|
|
coin_follow_list = ['BTC', 'ETH', 'SOL', 'GRASS', 'SUI', 'DOGE', 'ARB', 'ATH', 'MOVE']
|
|
|
+ # coin_follow_list = ['DOGE']
|
|
|
|
|
|
text = ''
|
|
|
|
|
|
+ data = {}
|
|
|
with sync_playwright() as playwright:
|
|
|
browser = playwright.chromium.launch(headless=True)
|
|
|
context = browser.new_context()
|
|
|
@@ -38,13 +40,20 @@ def get_chainalert():
|
|
|
|
|
|
temp_data = [s.replace('↑', '').replace('↓', '').split() for s in text_content]
|
|
|
print(temp_data[0])
|
|
|
- text += f'Ranking: {temp_data[0][0]}\n'
|
|
|
- text += f'Name: {temp_data[0][1]}\n'
|
|
|
- text += f'Price: {temp_data[0][2]}\n'
|
|
|
- text += f'24H Transaction Volume: {temp_data[0][3]}\n'
|
|
|
- text += f'24H Price Change: {temp_data[0][4]}\n'
|
|
|
- text += f'Market Capitalization: {temp_data[0][5]}\n'
|
|
|
- text += f'Diluted Market Value: {temp_data[0][6]}\n'
|
|
|
+
|
|
|
+ # 去重
|
|
|
+ if temp_data[0][1] not in data:
|
|
|
+ data[temp_data[0][1]] = temp_data[0]
|
|
|
+
|
|
|
+ # 将去重后的数据拼接到 text 中
|
|
|
+ for coin, value in data.items():
|
|
|
+ text += f'Ranking: {value[0]}\n'
|
|
|
+ text += f'Name: {coin}\n'
|
|
|
+ text += f'Price: {value[2]}\n'
|
|
|
+ text += f'24H Transaction Volume: {value[3]}\n'
|
|
|
+ text += f'24H Price Change: {value[4]}\n'
|
|
|
+ text += f'Market Capitalization: {value[5]}\n'
|
|
|
+ text += f'Diluted Market Value: {value[6]}\n'
|
|
|
text += '\n\n'
|
|
|
|
|
|
time.sleep(1)
|
|
|
@@ -122,16 +131,17 @@ def main():
|
|
|
if gas:
|
|
|
text += gas
|
|
|
|
|
|
- if text:
|
|
|
- GotifyNotifier('Real-time coin price\n', text, 'AgfOJESqDKftBTQ').send_message()
|
|
|
- else:
|
|
|
- print('No Data')
|
|
|
break
|
|
|
except Exception as e:
|
|
|
print(f'retry {i + 1}')
|
|
|
print(e)
|
|
|
time.sleep(5)
|
|
|
|
|
|
+ # if text:
|
|
|
+ # GotifyNotifier('Real-time coin price\n', text, 'AgfOJESqDKftBTQ').send_message()
|
|
|
+ # else:
|
|
|
+ # print('No Data')
|
|
|
+
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
main()
|