Yan Practice ⭕散修🎒's banner
Yan Practice ⭕散修🎒's profile picture

Yan Practice ⭕散修🎒

@practice_y11 • 15,182 subscribers

Crypto since 2017| ⭕rdinals|Inscription#81799 "Yan.sats"| 👉🏻 https://t.co/zu6WRzIZhz 👉🏻 https://t.co/UvfJSwwiHu

Shorts

【Day 2: 建構Meme幣熱度指標:AI解析社交數據 (Twitter)】 終於生出來啦,本來打算用推特本身的 API 但實在太貴了所以改用登入的方式,但不確定頻繁的檢索會不會被 BAN 各位自己注意; 這次的代碼沒加上迴圈,每次都手動搜尋,如果需要可以自己加上迴圈 (API會燒很快) 反正教學都是 Free 的,希望大家點個 LIKE 原碼會放在回應裡。 P.S 我的 @_kaitoai yap 已經連三天0分了 哈哈哈 自動分析 Twitter 熱度 + 情感指數,3 步驟找出潛力幣: 1. 即時掃描 最新代幣 2. 深度爬取 Twitter 討論(含情感分析) 3. 生成完整報告: - 代幣地址 - 社群提及量 - 市場情緒指數 【功能簡介】 - 自動 Twitter 認證系統 - 智能防爬蟲機制 - 數據庫即時更新 - NLP 情感模型分析 設置了推文獲取最大值為50 detector = SolanaTokenDetector(search_limit=50) 每次搜尋的交易數量為 10 async def fetch_pumpfun_new_tokens(self): .....limit=10 可以自行修改 使用方式: 1. 請使用 pip 安裝下列 Python 套件: pip install python-dotenv transformers playwright httpx solana solders tensorflow 注意: 安裝 playwright 後,需再執行一次瀏覽器安裝指令,以確保必要瀏覽器可用: playwright install 2. 設定 .env 檔案(需 RPC 與 Twitter 帳號) - 生成一個 .env 檔案 內容: # Solana RPC endpoint SOLANA_RPC="你的_SOL_API" # Twitter credentials TWITTER_USERNAME="推特_username" TWITTER_PASSWORD="推特_password" TWITTER_EMAIL="推特_email" # program addresses PUMP_FUN_PROGRAM_ID="6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" 執行流程: 1. 掃描鏈上最新代幣 2. 爬取Twitter社群討論 3. 計算情緒指數 4. 更新資料庫並輸出結果 Execution Flow: 1. Scan for the latest on-chain tokens 2. Crawl Twitter for community discussions 3. Calculate sentiment index 4. Update the database and output results ----- 函數功能說明: 【初始化模組】 def init(...): - 載入環境變量與NLP模型 - 建立SQLite資料庫連接 - 設定爬蟲參數與重試策略 - 禁用TensorFlow冗餘日誌 【資料庫初始化】 def _init_db(...): - 建立tokens主表儲存代幣鏈上數據 - 創建social_data表記錄社交指標 - 使用DATETIME類型記錄時間戳 - 設置social_analyzed分析狀態標記 【Twitter登入模組】 async def login_twitter(...): - Cookie持久化機制(加載/保存) - 處理雙因素驗證流程 - 自動填寫帳號/密碼/備用郵件 - 使用Playwright繞過登入檢測 【批量分析模組】 async def analyze_social_data_batch(...): - 啟動無頭Chromium實例 - 執行智慧滾動加載推文 - 提取tweetText元素內容 - 調用DistilBERT模型分析情感 - 計算平均情緒指數與提及量 【鏈上掃描模組】 async def fetch_pumpfun_new_tokens(...): - 監聽 - 解析交易metadata獲取mint地址 - 過濾重複代幣項目 - 寫入資料庫觸發後續分析 【交易解析函數】 async def get_transaction_details(...): - 解碼Solana交易結構 - 提取pre_token_balances數據 - 驗證程序ID歸屬 - 返回標準化代幣資訊 【報告生成函數】 def generate_report(...): - 聯表查詢代幣與社交數據 - 計算總提及次數與情緒均值 - 格式化控制台輸出 - 標記高潛力代幣(情緒>0.8) --For EN-- 【Initialization Module】 def init(...): - Load environment variables and the NLP model - Establish SQLite database connection - Set crawler parameters and retry strategy - Disable redundant TensorFlow logs 【Database Initialization】 def _init_db(...): - Create the "tokens" main table to store on-chain token data - Create the "social_data" table to record social metrics - Use the DATETIME type to store timestamps - Set the "social_analyzed" flag to track analysis status 【Twitter Login Module】 async def login_twitter(...): - Cookie persistence mechanism (load/save) - Handle two-factor authentication process - Auto-fill username, password, and backup email - Use Playwright to bypass login detection 【Batch Analysis Module】 async def analyze_social_data_batch(...): - Launch a headless Chromium instance - Perform intelligent scrolling to load tweets - Extract tweetText element content - Use the DistilBERT model for sentiment analysis - Calculate the average sentiment score and mention count 【On-chain Scanning Module】 async def fetch_pumpfun_new_tokens(...): - Monitor contract transactions - Parse transaction metadata to extract mint addresses - Filter out duplicate token entries - Write to the database to trigger further analysis 【Transaction Parsing Function】 async def get_transaction_details(...): - Decode Solana transaction structure - Extract pre_token_balances data - Verify program ID affiliation - Return standardized token information 【Report Generation Function】 def generate_report(...): - Perform join queries on tokens and social data - Calculate total mention count and average sentiment score - Format and output results to the console - Flag high-potential tokens (sentiment > 0.8) 總結: 這份代碼將區塊鏈資料抓取、資料庫管理、網頁自動化與 NLP 情感分析結合在一起,讓我們能夠自動化監控 Solana 上的新代幣動態,並從 Twitter 的輿情數據中了解市場對該代幣的反應。這對於快速捕捉市場動向、評估新代幣人氣和情感趨勢非常有幫助,也為後續投資決策或市場研究提供了數據支持。 當然現在很多網站都整理好了相關資訊,我們實做主要就是為了學習和嘗試看能不能看見有趣的新東西,希望對大家有幫助!

【Day 2: 建構Meme幣熱度指標:AI解析社交數據 (Twitter)】 終於生出來啦,本來打算用推特本身的 API 但實在太貴了所以改用登入的方式,但不確定頻繁的檢索會不會被 BAN 各位自己注意; 這次的代碼沒加上迴圈,每次都手動搜尋,如果需要可以自己加上迴圈 (API會燒很快) 反正教學都是 Free 的,希望大家點個 LIKE 原碼會放在回應裡。 P.S 我的 @_kaitoai yap 已經連三天0分了 哈哈哈 自動分析 Twitter 熱度 + 情感指數,3 步驟找出潛力幣: 1. 即時掃描 最新代幣 2. 深度爬取 Twitter 討論(含情感分析) 3. 生成完整報告: - 代幣地址 - 社群提及量 - 市場情緒指數 【功能簡介】 - 自動 Twitter 認證系統 - 智能防爬蟲機制 - 數據庫即時更新 - NLP 情感模型分析 設置了推文獲取最大值為50 detector = SolanaTokenDetector(search_limit=50) 每次搜尋的交易數量為 10 async def fetch_pumpfun_new_tokens(self): .....limit=10 可以自行修改 使用方式: 1. 請使用 pip 安裝下列 Python 套件: pip install python-dotenv transformers playwright httpx solana solders tensorflow 注意: 安裝 playwright 後,需再執行一次瀏覽器安裝指令,以確保必要瀏覽器可用: playwright install 2. 設定 .env 檔案(需 RPC 與 Twitter 帳號) - 生成一個 .env 檔案 內容: # Solana RPC endpoint SOLANA_RPC="你的_SOL_API" # Twitter credentials TWITTER_USERNAME="推特_username" TWITTER_PASSWORD="推特_password" TWITTER_EMAIL="推特_email" # program addresses PUMP_FUN_PROGRAM_ID="6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" 執行流程: 1. 掃描鏈上最新代幣 2. 爬取Twitter社群討論 3. 計算情緒指數 4. 更新資料庫並輸出結果 Execution Flow: 1. Scan for the latest on-chain tokens 2. Crawl Twitter for community discussions 3. Calculate sentiment index 4. Update the database and output results ----- 函數功能說明: 【初始化模組】 def init(...): - 載入環境變量與NLP模型 - 建立SQLite資料庫連接 - 設定爬蟲參數與重試策略 - 禁用TensorFlow冗餘日誌 【資料庫初始化】 def _init_db(...): - 建立tokens主表儲存代幣鏈上數據 - 創建social_data表記錄社交指標 - 使用DATETIME類型記錄時間戳 - 設置social_analyzed分析狀態標記 【Twitter登入模組】 async def login_twitter(...): - Cookie持久化機制(加載/保存) - 處理雙因素驗證流程 - 自動填寫帳號/密碼/備用郵件 - 使用Playwright繞過登入檢測 【批量分析模組】 async def analyze_social_data_batch(...): - 啟動無頭Chromium實例 - 執行智慧滾動加載推文 - 提取tweetText元素內容 - 調用DistilBERT模型分析情感 - 計算平均情緒指數與提及量 【鏈上掃描模組】 async def fetch_pumpfun_new_tokens(...): - 監聽 - 解析交易metadata獲取mint地址 - 過濾重複代幣項目 - 寫入資料庫觸發後續分析 【交易解析函數】 async def get_transaction_details(...): - 解碼Solana交易結構 - 提取pre_token_balances數據 - 驗證程序ID歸屬 - 返回標準化代幣資訊 【報告生成函數】 def generate_report(...): - 聯表查詢代幣與社交數據 - 計算總提及次數與情緒均值 - 格式化控制台輸出 - 標記高潛力代幣(情緒>0.8) --For EN-- 【Initialization Module】 def init(...): - Load environment variables and the NLP model - Establish SQLite database connection - Set crawler parameters and retry strategy - Disable redundant TensorFlow logs 【Database Initialization】 def _init_db(...): - Create the "tokens" main table to store on-chain token data - Create the "social_data" table to record social metrics - Use the DATETIME type to store timestamps - Set the "social_analyzed" flag to track analysis status 【Twitter Login Module】 async def login_twitter(...): - Cookie persistence mechanism (load/save) - Handle two-factor authentication process - Auto-fill username, password, and backup email - Use Playwright to bypass login detection 【Batch Analysis Module】 async def analyze_social_data_batch(...): - Launch a headless Chromium instance - Perform intelligent scrolling to load tweets - Extract tweetText element content - Use the DistilBERT model for sentiment analysis - Calculate the average sentiment score and mention count 【On-chain Scanning Module】 async def fetch_pumpfun_new_tokens(...): - Monitor contract transactions - Parse transaction metadata to extract mint addresses - Filter out duplicate token entries - Write to the database to trigger further analysis 【Transaction Parsing Function】 async def get_transaction_details(...): - Decode Solana transaction structure - Extract pre_token_balances data - Verify program ID affiliation - Return standardized token information 【Report Generation Function】 def generate_report(...): - Perform join queries on tokens and social data - Calculate total mention count and average sentiment score - Format and output results to the console - Flag high-potential tokens (sentiment > 0.8) 總結: 這份代碼將區塊鏈資料抓取、資料庫管理、網頁自動化與 NLP 情感分析結合在一起,讓我們能夠自動化監控 Solana 上的新代幣動態,並從 Twitter 的輿情數據中了解市場對該代幣的反應。這對於快速捕捉市場動向、評估新代幣人氣和情感趨勢非常有幫助,也為後續投資決策或市場研究提供了數據支持。 當然現在很多網站都整理好了相關資訊,我們實做主要就是為了學習和嘗試看能不能看見有趣的新東西,希望對大家有幫助!

10,682 görüntüleme

Videos

Daha fazla içerik yok.