diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bef2e5b..af33484 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,7 @@ name: Release # Bump VERSION in maplead/art.py, tag, push: -# git tag v1.4.0 && git push origin v1.4.0 +# git tag v1.4.1 && git push origin v1.4.1 # # A tag push builds the Linux AppImage only. The Windows job runs when the # workflow is started by hand (workflow_dispatch). @@ -67,26 +67,19 @@ jobs: tag_name: ${{ github.event.inputs.tag || github.ref_name }} name: ${{ steps.meta.outputs.name }} body: | - **MAPLEAD 1.4.0 — turbo mode (Linux)** - - Turbo mode searches city by city and business by business, and sends your - WhatsApp message to every lead that passes your filter — with no clicks in - between. - - **What's new** - - - **Turbo mode** (under *Run search*, or `Ctrl+T`): tick the cities and the - business types, pick the filter (*No website* by default) and start. It - searches the first business type in the first city, messages the matching - leads through the bulk sender, moves to the next business type and, after - the last one, to the next city — until the lists end or you press **Stop**. - - The same safety pauses as **Bulk send**. Leads already messaged are never - messaged twice. - - Finished searches are remembered, so starting turbo mode again continues - where it stopped. - - Every search uses provider credits; the setup window shows how many - searches your lists add up to. Turbo mode does not run with the Demo - provider. + **MAPLEAD 1.4.1 — sending no longer stops at the "not on WhatsApp" popup (Linux)** + + **What's fixed** + + - **Bulk send** and **Turbo mode** no longer wait for you to click the popup + WhatsApp shows for a number that has no account. The lead is marked + *Not on WhatsApp*, the popup is closed and the run goes on to the next lead. + - More wordings of that popup are recognised, and any other popup that keeps + the chat from opening is handled the same way after a few seconds; its text + is written to the activity log. + + New in 1.4.0: **Turbo mode** searches city by city and business by business, + and messages every lead that passes your filter. Full notes: https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md · guide: https://github.com/${{ github.repository }}/blob/main/docs/GUIDE.md diff --git a/CHANGELOG.md b/CHANGELOG.md index b1ccf47..3798370 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ All notable changes to MAPLEAD. Format follows [Keep a Changelog](https://keepac ## [Unreleased] +## [1.4.1] — 2026-11-12 + +### Fixed +- **Bulk send** and **Turbo mode** no longer wait for you to click the popup + WhatsApp shows for a number that has no account. More wordings of that popup + are recognised, any other popup that keeps the chat from opening is treated + the same way after a few seconds, and the popup is closed automatically. The + lead is marked *Not on WhatsApp* and the run goes on to the next one. + ## [1.4.0] — 2026-11-12 Linux (AppImage) only — the Windows build and the terminal wizard are unchanged diff --git a/README.md b/README.md index 55540ed..6ad2677 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,8 @@ lead-scraper API and writes them to CSV / Excel / JSON / TXT / TSV / HTML. **Linux x86_64, AppImage** — one file, no packages, no root: ```bash -chmod +x MAPLEAD-1.4.0-x86_64.AppImage -./MAPLEAD-1.4.0-x86_64.AppImage +chmod +x MAPLEAD-1.4.1-x86_64.AppImage +./MAPLEAD-1.4.1-x86_64.AppImage ``` Building it yourself (also fine for arm64/other distros with a rebuild): @@ -200,9 +200,9 @@ On Linux the wizard is inside the AppImage — the same file as the desktop app, nothing has to be installed first either: ```bash -./MAPLEAD-1.4.0-x86_64.AppImage --cli --demo -./MAPLEAD-1.4.0-x86_64.AppImage --cli --country DE --city Berlin --business dentist -./MAPLEAD-1.4.0-x86_64.AppImage --cli --doctor +./MAPLEAD-1.4.1-x86_64.AppImage --cli --demo +./MAPLEAD-1.4.1-x86_64.AppImage --cli --country DE --city Berlin --business dentist +./MAPLEAD-1.4.1-x86_64.AppImage --cli --doctor ``` You can add `~/.local/bin/maplead-cli` yourself (`#!/bin/sh` + `exec "$HOME/Apps"/MAPLEAD-*-x86_64.AppImage --cli "$@"`) diff --git a/docs/GUIDE.md b/docs/GUIDE.md index 2da9487..5baa48a 100644 --- a/docs/GUIDE.md +++ b/docs/GUIDE.md @@ -20,11 +20,11 @@ New here? Read this once, then the [README](../README.md) is just a reminder. ### Linux x86_64 -Download `MAPLEAD-1.4.0-x86_64.AppImage`, then: +Download `MAPLEAD-1.4.1-x86_64.AppImage`, then: ```bash -chmod +x MAPLEAD-1.4.0-x86_64.AppImage # first time only -./MAPLEAD-1.4.0-x86_64.AppImage +chmod +x MAPLEAD-1.4.1-x86_64.AppImage # first time only +./MAPLEAD-1.4.1-x86_64.AppImage ``` After `./build-appimage.sh --install` you can also just type `maplead`, and the app @@ -36,7 +36,7 @@ only things it expects from the system are a display and the usual C library. The same file runs the terminal wizard too — no Python needed: ```bash -./MAPLEAD-1.4.0-x86_64.AppImage --cli --demo +./MAPLEAD-1.4.1-x86_64.AppImage --cli --demo ``` **No FUSE?** Older AppImages mount themselves through `libfuse.so.2`. If your system @@ -283,7 +283,7 @@ The original interface, still fully supported and dependency-free: Without Python, the packaged builds carry the same wizard: ```bash -./MAPLEAD-1.4.0-x86_64.AppImage --cli --demo # Linux: the AppImage is both +./MAPLEAD-1.4.1-x86_64.AppImage --cli --demo # Linux: the AppImage is both .\MAPLEAD-1.2.0-windows-x64.exe --cli --demo # Windows: same trick, one .exe ``` diff --git a/maplead/art.py b/maplead/art.py index 9f5b101..f1031a8 100644 --- a/maplead/art.py +++ b/maplead/art.py @@ -10,7 +10,7 @@ from . import host -VERSION = "1.4.0" +VERSION = "1.4.1" # --------------------------------------------------------------------------- # # colour plumbing diff --git a/maplead/gui/bulk_sender.py b/maplead/gui/bulk_sender.py index e7a4d08..c62955f 100644 --- a/maplead/gui/bulk_sender.py +++ b/maplead/gui/bulk_sender.py @@ -51,6 +51,7 @@ OPEN_TIMEOUT = 60 # chat must open (or be reported invalid) by then VERIFY_TIMEOUT = 20 # the composer must empty after clicking send ENTER_FALLBACK_AT = 5 # press Enter ourselves if the click did nothing +DIALOG_PATIENCE = 6 # a popup that stays this long, with no chat, blocks the lead # --------------------------------------------------------------------------- # @@ -100,6 +101,16 @@ def webengine_available() -> bool: 'button[aria-label="Enviar"]', 'div[aria-label="Send"]', 'div[aria-label="Enviar"]']); }; +var mlDialogs = function () { + var found = document.querySelectorAll( + '[data-animate-modal-popup="true"], [data-animate-modal-body="true"], ' + + 'div[role="dialog"], div[role="alertdialog"], [aria-modal="true"]'); + var list = []; + for (var i = 0; i < found.length; i++) { + if ((found[i].innerText || '').trim()) list.push(found[i]); + } + return list; +}; var mlComposer = function () { return mlq(['footer div[contenteditable="true"]', 'div[contenteditable="true"][data-tab="10"]', @@ -114,12 +125,19 @@ def webengine_available() -> bool: 'div[aria-label="Lista de chats"]']); var qr = mlq(['canvas[aria-label*="QR"]', 'canvas[aria-label*="qr"]', 'div[data-ref] canvas', '[data-testid="qrcode"]']); - var dialog = mlq(['[data-animate-modal-popup="true"]', 'div[role="dialog"]']); + var dialogs = mlDialogs(); + var text = ''; + var buttons = 0; + for (var i = 0; i < dialogs.length; i++) { + text += ' ' + (dialogs[i].innerText || ''); + buttons += dialogs[i].querySelectorAll('button, [role="button"]').length; + } var composer = mlComposer(); return JSON.stringify({ logged: !!side || !!composer, qr: !!qr, - dialog: dialog ? (dialog.innerText || '').slice(0, 400) : '', + dialog: text.trim().slice(0, 400), + buttons: buttons, send: !!mlSend(), composer: composer ? (composer.innerText || '').trim().length : -1 }); @@ -136,6 +154,18 @@ def webengine_available() -> bool: })(); """ +# closes the popup WhatsApp leaves open for a number it could not open +_JS_DISMISS_DIALOG = _JS_HELPERS + r""" +(function () { + var dialogs = mlDialogs(); + for (var i = 0; i < dialogs.length; i++) { + var all = dialogs[i].querySelectorAll('button, [role="button"]'); + if (all.length) { all[all.length - 1].click(); return true; } + } + return false; +})(); +""" + _JS_FOCUS_COMPOSER = _JS_HELPERS + r""" (function () { var c = mlComposer(); @@ -146,8 +176,12 @@ def webengine_available() -> bool: """ # texts of the popup WhatsApp shows for a number that has no account -_INVALID_RE = re.compile(r"invalid|inv[áa]lid|no v[áa]lido|ung[üu]ltig|non valide|" - r"not on whatsapp|n[ãa]o est[áa] no whatsapp", re.I) +_INVALID_RE = re.compile( + r"invalid|inv[áa]lid|no v[áa]lido|ung[üu]ltig|non valide|" + r"(not|n['’]t|n[ãa]o|no|nicht|pas)\b[^.\n]{0,40}\bwhatsapp|" + r"whatsapp[^.\n]{0,40}\b(n[ãa]o|not|no)\b|" + r"n[ãa]o (existe|foi poss[íi]vel|encontr)|(couldn.t|could not|unable to) find|" + r"doesn.t exist|does not exist|no existe", re.I) # popups that are only a "please wait" _LOADING_RE = re.compile(r"starting chat|iniciando|loading|carregando|cargando", re.I) @@ -524,6 +558,7 @@ def __init__(self, items: Sequence[outreach.OutreachItem], self._daily_ok = False # user agreed to go over the cap self._enter_tried = False self._loaded = False # the current lead's page finished loading + self._dialog_for = 0 # seconds a popup has been blocking the chat self.setWindowTitle("MAPLEAD — WhatsApp sender") self.setModal(False) @@ -715,10 +750,19 @@ def _on_probe(self, raw: Any) -> None: if state == self.OPENING: dialog = str(info.get("dialog") or "") - if dialog and _INVALID_RE.search(dialog) and not _LOADING_RE.search(dialog): + blocking = bool(dialog) and not _LOADING_RE.search(dialog) + if blocking and _INVALID_RE.search(dialog): + self._dismiss_dialog() self._finish(outreach.INVALID) elif info.get("send"): self.page.runJavaScript(_JS_CLICK_SEND, 0, self._on_clicked) + elif (blocking and info.get("buttons") and info.get("logged") + and self._dialog_step() >= DIALOG_PATIENCE): + # WhatsApp is showing a popup this build does not recognise and + # the chat never opened: do not wait for someone to click it + self._dismiss_dialog() + self._finish(outreach.INVALID, + "WhatsApp said: " + " ".join(dialog.split())[:120]) elif info.get("qr") and not info.get("logged"): self.log.write("WhatsApp Web logged out — scan the QR code again", "warn") self._index -= 1 @@ -738,6 +782,13 @@ def _on_probe(self, raw: Any) -> None: self.page.runJavaScript(_JS_FOCUS_COMPOSER, 0, lambda ok: self._press_enter() if ok else None) + def _dialog_step(self) -> int: + self._dialog_for += 1 + return self._dialog_for + + def _dismiss_dialog(self) -> None: + self.page.runJavaScript(_JS_DISMISS_DIALOG, 0, lambda _ok: None) + def _on_clicked(self, ok: Any) -> None: if self._state != self.OPENING: return @@ -791,6 +842,7 @@ def _open_next(self) -> None: f"+{item.number} · lead {nxt + 1} of {len(self.items)}") self.log.write(f"→ {item.name} (+{item.number})", "query") self._loaded = False + self._dialog_for = 0 self.page.load(QUrl(url)) def _finish(self, status: str, error: str = "") -> None: