windowdog 1 сар өмнө
parent
commit
e67ab1cda9

+ 0 - 133
src/code/tamper_listen_filter_pump_token_gmgn.js

@@ -1,133 +0,0 @@
-// ==UserScript==
-// @name         get_filter_pump_token_gmgn
-// @namespace    http://tampermonkey.net/
-// @version      2025-02-16
-// @description  try to take over the world!
-// @author       You
-// @match        https://gmgn.ai/meme/9Z7Wz20p?chain=sol&tab=complete*
-// @icon         https://www.google.com/s2/favicons?sz=64&domain=gmgn.ai
-// @grant        none
-// ==/UserScript==
-
-
-// https://gmgn.ai/meme/9Z7Wz20p?chain=sol
-// https://gmgn.ai/meme/9Z7Wz20p?chain=sol&tab=complete
-
-
-function funcDownload(content, filename) {
-    console.log('begin download');
-    // 创建隐藏的可下载链接
-    let eleLink = document.createElement('a');
-    eleLink.download = filename;
-    eleLink.style.display = 'none';
-    // 字符内容转变成blob地址
-    let blob = new Blob([content]);
-    eleLink.href = URL.createObjectURL(blob);
-    // 触发点击
-    document.body.appendChild(eleLink);
-    eleLink.click();
-    // 然后移除
-    document.body.removeChild(eleLink);
-}
-
-
-function sleep(sleepdelay) {
-    return new Promise((resolve, reject) => {
-        setTimeout(() => {
-            resolve(sleepdelay);
-        }, sleepdelay);
-    })
-}
-
-
-let tbody = document.querySelector('#__next > div > div > main > div.css-xe3de5 > div.css-b0bdxf > div > div > div > div > div.g-table-tbody-virtual.g-table-tbody > div.g-table-tbody-virtual-holder > div > div')
-let arr_token_row = Array.from(tbody.children);
-let arr_res_data = [];
-// let arr_title = ['token_url', 'token_name', 'age', 'liq/initial', 'mc', 'holders', '24h txs', '24h vol', 'price', '1m%', '5m%', '1h%', 'degen audit', 'dev'];
-
-let arr_title = ['token_url', 'token_name', 'age', 'liq/initial', 'mc', 'holders', 'nomint', 'blacklist', 'burnt', 'top 10', 'insiders', 'dev'];
-
-
-
-function save_resdata() {
-    console.log("enter save_resdata");
-    arr_res_data.forEach((val, index, arr) => { arr[index] = val.join() + "\n" });
-
-    funcDownload(res_data.join(""), "gmgn_pump_" + parseInt(Date.now() / 1000) + ".csv");
-    arr_res_data = [];
-
-}
-
-for (let idx = 0; idx < arr_token_row.length; idx++) {
-    let arr_cur = [];
-    let arr_td = Array.from(arr_token_row[idx].children);
-    for (let idx2 = 0; idx2 < arr_td.length; idx2++) {
-        if (idx2 == 0) {
-            // Token
-            let a_ele = arr_td[idx2].querySelector('a');
-            // arr_cur.push(arr_td[idx2].querySelector('a').href);
-            let url_ = a_ele.href;
-            let title = a_ele.querySelector('[title]').getAttribute('title');
-            // title = "RONASZN"
-            arr_cur.push(url_);
-            arr_cur.push(title);
-
-
-        }
-        else if (idx2 == 1) {
-            // Age
-            arr_cur.push(arr_td[idx2].innerText);
-        }
-        else if (idx2 == 2) {
-            // Liq /initial
-
-        }
-        else if (idx2 == 3) {
-            //  MC  
-            arr_cur.push(arr_td[idx2].innerText);
-        }
-        else if (idx2 == 4) {
-            // holders
-            arr_cur.push(arr_td[idx2].innerText);
-        }
-        else if (idx2 == 5) {
-            // 24txns
-
-        }
-        else if (idx2 == 6) {
-            // 24vol
-
-        }
-        else if (idx2 == 7) {
-            // price
-
-        } else if (idx2 == 8) {
-            // 1m%
-        }
-        else if (idx2 == 9) {
-            // 5m%
-
-        }
-        else if (idx2 == 10) {
-            // 1h%
-
-        } else if (idx2 == 11) {
-            // degen audit
-
-            //  'nomint', 'blacklist', 'burnt', 'top 10', 'insiders' 
-
-            let arr_ = arr_td[idx2].innerText.split(/\s+/);
-            arr_cur.push(arr_[0]);
-            arr_cur.push(arr_[2]);
-            arr_cur.push(arr_[4]);
-            arr_cur.push(arr_[6]);
-            arr_cur.push(arr_[9]);
-        } else if (idx2 == 12) {
-            // dev
-            arr_cur.push(arr_td[idx2].innerText.trim().replace(/[\n-]+/g, '-'));
-        }
-
-    }
-    arr_res_data.push(arr_cur);
-
-}

+ 158 - 46
src/code/tamper_listen_gmgn_token_long.js

@@ -1,16 +1,16 @@
 // ==UserScript==
-// @name         Dex-Filter-ListenToken-Long-SOL
+// @name         get_filter_pump_token_gmgn
 // @namespace    http://tampermonkey.net/
-// @version      0.1
+// @version      2025-02-16
 // @description  try to take over the world!
 // @author       You
-// @match        https://dexscreener.com/new-pairs?rankBy=txns&order=desc&chainIds=solana&dexIds=raydium&minLiq=8000&minAge=48&min24HTxns=300&min24HBuys=100&min1HChg=4&min5MChg=2
-// @icon         https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
+// @match        https://gmgn.ai/meme/9Z7Wz20p?chain=sol&tab=complete*
+// @icon         https://www.google.com/s2/favicons?sz=64&domain=gmgn.ai
 // @grant        none
-
 // ==/UserScript==
 
-
+// https://gmgn.ai/meme/9Z7Wz20p?chain=sol
+// https://gmgn.ai/meme/9Z7Wz20p?chain=sol&tab=complete
 
 function funcDownload(content, filename) {
     // 创建隐藏的可下载链接
@@ -37,34 +37,29 @@ function sleep(sleepdelay) {
 }
 
 
-
+var is_getting_data = false;
 
 var pre_click_timestamp = 0;
-
+var pre_save_data_timestamp = 0;
 var now_timestamp = 0;
 
-function click_avoid_sleep() {
-    if (now_timestamp - pre_click_timestamp >= 2 * 60 * 1000) {
-        pre_click_timestamp = now_timestamp;
-        let th = document.querySelector("div.ds-dex-table-th");
 
-        let button_click = th.children[5].querySelector("button");
-        button_click.click();
-    }
 
-
-
-}
 function click_avoid_sleep() {
-    if (now_timestamp - pre_click_timestamp >= 2 * 60 * 1000) {
-        pre_click_timestamp = now_timestamp;
-        let th = document.querySelector("div.ds-dex-table-th");
 
-        let button_click = th.children[5].querySelector("button");
-        button_click.click();
+    if (is_getting_data == true) {
+        return;
     }
+    if (now_timestamp - pre_click_timestamp >= 1 * 60 * 1000) {
+        // if (now_timestamp - pre_click_timestamp >= 20 * 1000) {
+        pre_click_timestamp = now_timestamp;
+        // let th = document.querySelector("div.ds-dex-table-th");
 
+        let ele_th = document.querySelector('#__next > div > div > main > div.css-xe3de5 > div.css-b0bdxf > div > div > div > div > div.g-table-header > table > thead > tr > th.g-table-cell.g-table-column-sort.g-table-column-has-sorters')
 
+        // let button_click = th.children[5].querySelector("button");
+        ele_th.click();
+    }
 
 }
 
@@ -72,48 +67,153 @@ function click_avoid_sleep() {
 
 
 async function get_tbody_data() {
+    console.log("get_tbody_data")
 
+    now_timestamp = Date.now();
 
+    if (is_getting_data == true) {
 
-    now_timestamp = Date.now();
 
-    click_avoid_sleep();
-    save_resdata();
+        return;
+    }
 
-}
 
+    is_getting_data = true;
+    for (let i = 0; i < 5; i++) {
+        console.log('scoll bottom i=', i);
+        let tbody = document.querySelector('#__next > div > div > main > div.css-xe3de5 > div.css-b0bdxf > div > div > div > div > div.g-table-tbody-virtual.g-table-tbody > div.g-table-tbody-virtual-holder > div > div')
+        let arr_token_row = Array.from(tbody.children);
+        await get_current_view_data(arr_token_row);
 
 
-function save_resdata() {
-    // console.log("enter save_resdata");
-    drop_outtime_pairaddress();
+        let top_butttom = arr_token_row[arr_token_row.length - 1].getBoundingClientRect().top;
+        // console.log('-1 ', arr_token_row[parseInt(arr_token_row.length - 1)].innerText.split(/\s+/)[0])
 
-    let set_intersection_pairaddress = new Set([...set_now_pairaddress].filter(value => set_pre_pairaddress.has(value)));
+        let new_scrollTop = top_butttom;
 
+        let ele_scroll = document.querySelector("#__next > div > div > main > div.css-xe3de5 > div.css-b0bdxf > div > div > div > div > div.g-table-tbody-virtual.g-table-tbody > div.g-table-tbody-virtual-holder");
 
-    // console.log("set_intersection_pairaddress=", set_intersection_pairaddress, 'set_pre_pairaddress=', set_pre_pairaddress, "set_now_pairaddress=", set_now_pairaddress);
-    set_pre_pairaddress.clear();
-    set_pre_pairaddress = set_now_pairaddress;
-    set_now_pairaddress = new Set();
+        let bef_sTop = ele_scroll.scrollTop;
+        ele_scroll.scrollTop = new_scrollTop;
+        await sleep(500);
+        let aft_sTop = ele_scroll.scrollTop;
+        console.log(bef_sTop, aft_sTop);
 
 
-    if (set_intersection_pairaddress.size == 0) {
-        return;
+        if (bef_sTop >= aft_sTop) {
+            break;
+        }
     }
 
 
-    let temp_arr_res_data = arr_res_data;
+    for (let i = 0; i < 3; i++) {
+        let ele_scroll = document.querySelector("#__next > div > div > main > div.css-xe3de5 > div.css-b0bdxf > div > div > div > div > div.g-table-tbody-virtual.g-table-tbody > div.g-table-tbody-virtual-holder");
 
-    arr_res_data = [];
+        ele_scroll.scrollTop = 0;
+
+        await sleep(500);
+    }
+    is_getting_data = false;
 
-    for (let it of temp_arr_res_data) {
 
 
-        arr_res_data.push(it);
 
+    click_avoid_sleep();
+    save_resdata();
+
+}
+
+async function get_current_view_data(arr_token_row) {
+
+    for (let idx = 0; idx < arr_token_row.length; idx++) {
+        let arr_cur = [];
+        let arr_td = Array.from(arr_token_row[idx].children);
+        for (let idx2 = 0; idx2 < arr_td.length; idx2++) {
+            if (idx2 == 0) {
+                // Token
+                let a_ele = arr_td[idx2].querySelector('a');
+                // arr_cur.push(arr_td[idx2].querySelector('a').href);
+                let url_ = a_ele.href;
+                let title = a_ele.querySelector('[title]').getAttribute('title');
+                // title = "RONASZN"
+                arr_cur.push(url_);
+                arr_cur.push(title);
+
+
+            }
+            else if (idx2 == 1) {
+                // Age
+                arr_cur.push(arr_td[idx2].innerText);
+            }
+            else if (idx2 == 2) {
+                // Liq /initial
+
+            }
+            else if (idx2 == 3) {
+                //  MC
+                arr_cur.push(arr_td[idx2].innerText);
+            }
+            else if (idx2 == 4) {
+                // holders
+                arr_cur.push(arr_td[idx2].innerText);
+            }
+            else if (idx2 == 5) {
+                // 24txns
+
+            }
+            else if (idx2 == 6) {
+                // 24vol
+
+            }
+            else if (idx2 == 7) {
+                // price
+
+            } else if (idx2 == 8) {
+                // 1m%
+            }
+            else if (idx2 == 9) {
+                // 5m%
+
+            }
+            else if (idx2 == 10) {
+                // 1h%
+
+            } else if (idx2 == 11) {
+                // degen audit
+
+                //  'nomint', 'blacklist', 'burnt', 'top 10', 'insiders'
+
+                let arr_ = arr_td[idx2].innerText.split(/\s+/);
+                // console.log('arr_=', arr_);
+                arr_cur.push(arr_[0]);
+                arr_cur.push(arr_[2]);
+                arr_cur.push(arr_[4]);
+                arr_cur.push(arr_[6]);
+                arr_cur.push(arr_[9]);
+            } else if (idx2 == 12) {
+                // dev
+
+                arr_cur.push(arr_td[idx2].innerText.trim().replace(/[\n-]+/g, '_'));
+            }
+
+        }
+        arr_res_data.push(arr_cur);
 
     }
 
+}
+
+
+function save_resdata() {
+
+    // 一个小时保存一次
+
+    if (now_timestamp - pre_save_data_timestamp >= 1 * 60 * 60 * 1000) {
+        // if (now_timestamp - pre_save_data_timestamp >= 60 * 1000) {
+        pre_save_data_timestamp = now_timestamp;
+    } else {
+        return;
+    }
 
 
     if (arr_res_data.length == 0) {
@@ -122,15 +222,18 @@ function save_resdata() {
         return;
     }
 
-    // console.log("arr_res_data=", arr_res_data)
-    arr_res_data.unshift(["timestamp", "pairaddress", "price", "5m", "1h", "6h", "24h"]);
+
+    let arr_title = ['token_url', 'token_name', 'age', 'mc', 'holders', 'nomint', 'blacklist', 'burnt', 'top 10', 'insiders', 'dev'];
+
+
+    arr_res_data.unshift(arr_title);
 
     arr_res_data.forEach((val, index, arr) => { arr[index] = val.join() + "\n" });
 
     let str_cur_time = "" + Date.now();
 
 
-    funcDownload(arr_res_data.join(""), str_cur_time + "_long" + ".csv");
+    funcDownload(arr_res_data.join(""), str_cur_time + "_gmgn_filter" + ".csv");
     arr_res_data = [];
 
 }
@@ -148,13 +251,22 @@ function autoScroll() {
 
 
 var arr_res_data = [];
-var set_pre_pairaddress = new Set();
-var set_now_pairaddress = new Set();
+
 // window.addEventListener('load', () => {
 
 (async function () {
     console.log("enter load");
     await sleep(6000);
+
+    let btn_close = document.querySelector('body div.css-12rtj2z div.css-pt4g3d');
+
+
+    if (btn_close) {
+
+        await btn_close.click();
+    }
+
+
     autoScroll();