如何精准读取DMIT的官方剩余流量信息呢??

Cyrus9527 2026-10-27 10:31 1

或者误差1%左右????瓦工有api,大妈没有呀。网卡统计的太不准了。每个月误差大的时候有150双向+。

最新回复 (12)
  • Nihil 10-27 10:31
    1楼

    +我也好奇,自己统计的都比官方统计的少

  • Cyrus9527 楼主 10-27 10:33
    2楼

    @Nihil #1 我是比官方统计的多。

  • RSKJSN 10-27 10:34
    3楼

    ^-^ 我也挺烦这个统计不准有没有官方API

  • v404 10-27 10:36
    4楼

    这是个好话题!

  • Timi1 10-27 10:37
    5楼

    用cookie token调接口?dmit的登录保活时间还挺长的

  • Krius7 10-27 10:39
    6楼

    抓包让AI搓 ^-^

  • ashui33413 10-27 10:44
    7楼

    @Krius7 #6 发布于10/27/2026, 10:39:24 AM

    抓包让AI搓 ^-^


    搓出来了么

  • Krius7 10-27 10:45
    8楼

    @ashui33413 #7 没有这个需求,每个月根本用不完 ^-^

  • hryen 10-27 10:48
    9楼
    from playwright.sync_api import sync_playwright
    import json
    import time
    import requests

    MANUAL_SESSION_COOKIES = [
    {
    "name": "WHMCSUser",
    "value": "xxx",
    "domain": "www.dmit.io",
    "path": "/"
    },
    {
    "name": "cf_app_sid",
    "value": "xxx",
    "domain": "www.dmit.io",
    "path": "/"
    },
    {
    "name": "cf_clearance",
    "value": "xxx",
    "domain": ".dmit.io",
    "path": "/"
    }
    ]

    def get_page_with_cf_bypass(url, existing_cookies):
    with sync_playwright() as p:
    browser = p.chromium.launch(
    headless=True, # 有头模式更容易过检测
    args=['--disable-blink-features=AutomationControlled'],
    )
    context = browser.new_context(
    user_agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
    viewport={'width': 1280, 'height': 800},
    )

    # 注入已有 cookie(如果有的话)
    if existing_cookies:
    context.add_cookies(existing_cookies)

    page = context.new_page()
    try:
    # print("访问页面并等待 Cloudflare 验证...")
    page.goto(url, wait_until='networkidle', timeout=30000)

    retries = 0
    while retries < 6:
    title = page.title()
    if 'Just a moment' not in title and 'Checking' not in title:
    break
    print("仍在挑战页面,等待中...")
    time.sleep(3)
    retries += 1

    cookies = context.cookies()
    # with open('cf_cookies.json', 'w') as f:
    # json.dump(cookies, f, indent=2)

    json_text = page.locator("pre").inner_text()
    return json_text, cookies

    finally:
    browser.close()

    def send_telegram_message(
    bot_token: str,
    chat_id: str,
    text: str,
    timeout: int,
    ) -> None:
    url = f"https://api.telegram.org/bot{bot_token}/sendMessage"
    response = requests.post(
    url,
    json={
    "chat_id": chat_id,
    "parse_mode": "HTML",
    "text": text,
    },
    timeout=timeout,
    )
    response.raise_for_status()

    payload = response.json()
    if not payload.get("ok"):
    raise RuntimeError(f"Telegram 返回异常: {payload}")

    if __name__ == "__main__":
    url = "https://www.dmit.io/clientarea.php?action=productdetails&id=ID&json=1&pure=1&page=standard&subaction=whmcsdetail"
    json_text, cookies = get_page_with_cf_bypass(url, MANUAL_SESSION_COOKIES)

    data = json.loads(json_text)
    try:
    send_telegram_message(
    bot_token='xxx',
    chat_id='xxx',
    text=f"<b>DMIT Transfer</b>\n"
    # f"Used {r['bwusage'] / 1024:.2f} GB </b>( In {r['bwusage_in'] / 1024:.2f} GB, Out {r['bwusage_out'] / 1024:.2f} GB )\n"
    # f"Last update: {r['lastupdate']} UTC",
    # f"status: {r['status']}\n"
    # f"dedicatedip: {r['dedicatedip']}\n"
    f"<code>bwusage: {r['bwusage'] / 1024:.2f} GB\n"
    f"bwusage_in: {r['bwusage_in'] / 1024:.2f} GB\n"
    f"bwusage_out: {r['bwusage_out'] / 1024:.2f} GB\n"
    f"lastupdate: {r['lastupdate']} UTC</code>",
    timeout=20,
    )
    except Exception as exc:
    print("执行失败: %s", exc)


    自用的,改改url的id,cookie,tg bot的token和发送的群组id就能用了

  • hryen 10-27 10:49
    10楼

    效果


  • Cyrus9527 楼主 10-27 10:55
    11楼

    @hryen #10 晚点我试试去

  • Cyrus9527 楼主 10-27 10:57
    12楼

    @hryen #10 这个有啥缺点吗??比如多久的登陆一次什么的??

* 帖子来源NodeSeek
返回