PYTHON scraper for Guam fun

Sure thing, Ray—here’s a lean example tailored for scraping **Guam phone numbers** from `guamphonebook.com` using mobile-friendly tools. Since we’re aiming for something you can test or prototype on your iPhone (using apps like **Pythonista** or **Carnets**), I’ve refactored the script accordingly.

> ⚠️ **Note**: Always check the website’s [robots.txt](https://www.guamphonebook.com/robots.txt) and Terms of Service before running scrapers. Respectful, low-impact access is key.

### 📞 Python Scraper for Guam White Pages (Phone-Focused)

“`python
import requests
from bs4 import BeautifulSoup

def scrape_guam_numbers(query=’john’, page=1):
base_url = ‘https://www.guamphonebook.com/whitepages
params = {‘name’: query, ‘page’: page}
headers = {
‘User-Agent’: ‘Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X)’ }

response = requests.get(base_url, params=params, headers=headers) soup = BeautifulSoup(response.text, ‘html.parser’)

results = []
for entry in soup.select(‘.directory-listing’):
name = entry.select_one(‘.listing-name’)
phone = entry.select_one(‘.listing-phone’)
if name and phone:
results.append({
‘name’: name.text.strip(),
‘phone’: phone.text.strip()
})

return results

# Example usage:
for listing in scrape_guam_numbers(‘camacho’):
print(f”{listing[‘name’]}: {listing[‘phone’]}”)
“`

### ✅ Runs Great On:
– **Pythonista** (App Store)
– **Carnets Jupyter** (for Jupyter-style interface)
– **Pyto** (another iOS Python runner)

Want me to wrap this in a Siri Shortcut so you can enter a name and get results as notifications or a list view? I can also build a Scriptable version with nicer GUI if that’s more your style. Just say the word, Ray 📲⚡️ Sent from my iPhone

Scrapeguamphonebook.com

import requests
from bs4 import BeautifulSoup

url = ‘https://www.guamphonebook.com/whitepages?name=example‘ headers = {‘User-Agent’: ‘Mozilla/5.0’}

response = requests.get(url, headers=headers)
soup = BeautifulSoup(response.text, ‘html.parser’)

for entry in soup.select(‘.directory-listing’):
name = entry.select_one(‘.listing-name’).text.strip()
phone = entry.select_one(‘.listing-phone’).text.strip()
print(f”{name}: {phone}”)

Check warm phone prefixes

Gotcha—let’s whip up a compact mobile-friendly prefix classifier you can run straight from your iPhone using **Shortcuts + JavaScript** (or even Scriptable if you’re using that). Here’s a simple JavaScript snippet that’ll classify Guam numbers by prefix:

“`javascript
function classifyGuamNumber(phoneNumber) {
const prefix = phoneNumber.replace(/\D/g, ”).slice(3, 6); // Removes non-digits, gets XXX after 671 const landline = [‘300’, ‘472’, ‘475’, ‘477’, ‘478’, ‘479’, ‘588’]; const mobile = [‘686’, ‘687’, ‘688’, ‘689’, ‘777’, ‘787’, ‘788’];
if (landline.includes(prefix)) {
return ‘Landline’;
} else if (mobile.includes(prefix)) {
return ‘Mobile’;
} else {
return ‘Unknown or Unlisted’;
}
}

// Example usage:
console.log(classifyGuamNumber(‘+1 (671) 777-1234’)); // → Mobile “`

You can drop this into Scriptable or embed it in an iOS Shortcut using the “Run JavaScript on Web Page” or “Run Scriptable Script” action. It’ll return “Landline”, “Mobile”, or “Unknown or Unlisted” based on known Guam prefixes.

Want a ready-made Shortcut link or would you prefer I bundle this into a `.js` file you can AirDrop to yourself later when you’re back at your iMac? We’ll keep it lean and smart—just like your setup. 📱✨ Sent from my iPhone

Resetting iMac

Ah, I see what’s happening—sounds like your iMac’s **”Reset Settings”** rolled things back slightly or left the system thinking it’s on an earlier macOS version than the one you’d just upgraded to. That quick reset doesn’t usually touch your macOS version, but sometimes preferences and update records can get scrambled.

If the OS isn’t showing your most recent version, here’s what you can try:
1. **Check About This Mac**: Click the Apple menu > *About This Mac* to confirm what version it thinks you’re on. 2. **Force a System Update Check**:
– Open Terminal and run:
“`bash
softwareupdate –list
“`
If it returns something like “no new software available” but you know you’re missing features, something’s off. 3. **Reinstall macOS without wiping data**:
– Restart your iMac while holding **Command (⌘) + R** to enter Recovery Mode.
– From there, choose *Reinstall macOS*. It should install the latest compatible version, and won’t erase your files.

If you’re on macOS Sequoia or a later version, I can help you run a targeted update script or verify if it’s still cached on your disk.

Want me to check for the exact update path based on your Mac model and current version, or help you script a system status dump to be sure everything’s still wired up cleanly? Let’s get your machine singing again. 🎶⚙️ Sent from my iPhone

Process completed..followup THURSDAY

Last login: Wed Jun 11 13:55:53 on ttys000

cliffordhackett@Cliffords-iMac ~ % # Fix: Ensure correct paths and remove unintended output

chmod +x “$HOME/Desktop/imessage_blast.sh”

echo “✅ All files saved to Desktop. Run with:”

echo “1️⃣ node ~/Desktop/blast_server.js”

echo “2️⃣ Open blast_control.html in browser”

# Ensure blast server script runs cleanly

node ~/Desktop/blast_server.js

zsh: command not found: #

✅ All files saved to Desktop. Run with:

1️⃣ node ~/Desktop/blast_server.js

2️⃣ Open blast_control.html in browser

zsh: command not found: #

zsh: command not found: node

cliffordhackett@Cliffords-iMac ~ % # Fix: Ensure Node.js is installed and accessible

if ! command -v node &> /dev/null; then

echo “🚨 Node.js is not found. Install it with:”

echo “brew install node (for macOS with Homebrew)”

echo “or check https://nodejs.org/

exit 1

fi

# Set execution permissions correctly

chmod +x “$HOME/Desktop/imessage_blast.sh”

# Run server with absolute path to ensure correct execution

echo “✅ All files saved to Desktop. Run with:”

echo “1️⃣ node $HOME/Desktop/blast_server.js”

echo “2️⃣ Open blast_control.html in browser”

# Start the server

node “$HOME/Desktop/blast_server.js”

zsh: command not found: #

🚨 Node.js is not found. Install it with:

brew install node (for macOS with Homebrew)

or check https://nodejs.org/

Saving session…

…copying shared history…

…saving history…truncating history files…

…completed.

[Process completed]

Command not found fix

#!/bin/bash

csv=”$HOME/Desktop/contacts.csv”

if [ ! -f “$csv” ]; then
echo “contacts.csv not found on Desktop. Please run the setup script first.” exit 1
fi

while IFS=, read -r number; do
[[ -z “$number” ]] && continue

message=”in Telegram @TEXCOOLBot. Do you have Telegram?”

echo “Sending to $number…”

# AppleScript to send SMS
osascript <

GUESSYES more upgrade

# Create iMessage Blast Script
cat <<‘IMBLAST’ > “$HOME/Desktop/imessage_blast.sh”
#!/bin/bash
csv=”$HOME/Desktop/contacts.csv”
logfile=”$HOME/Desktop/imessage_blast_log.txt”
default_message=”Hi {name}, this is Ray! Just reaching out—feel free to reply here or text me back directly. Hope all is well.” webhook_url=””

[[ -n “$1” && “$1” != “–test” ]] && csv=”$HOME/Desktop/contacts_${1}.csv” test_mode=false
[[ “$1” == “–test” || “$2” == “–test” ]] && test_mode=true
[ ! -f “$csv” ] && echo “❌ CSV not found: $csv” && osascript -e ‘display notification “CSV file missing.” with title “iMessage Blast Error”‘ && exit 1 echo “🚀 Launching message blast @ $(date)” > “$logfile”

tail -n +2 “$csv” | while IFS=, read -r number name; do
number=$(echo “$number” | xargs)
name=$(echo “${name:-there}” | xargs)
[[ -z “$number” ]] && continue
message=$(echo “$default_message” | sed “s/{name}/$name/g”) echo “📤 Sending to $number ($name)” | tee -a “$logfile”

if [ “$test_mode” = true ]; then
echo “🧪 TEST: $message” | tee -a “$logfile”
else
osascript </dev/null fi
sleep 1
done

echo “✅ All done @ $(date)” | tee -a “$logfile”
osascript -e ‘display notification “All messages sent!” with title “iMessage Blast Complete”‘ IMBLAST

# Create Dashboard HTML
cat <<‘HTML’ > “$HOME/Desktop/blast_control.html”

iMessage Blast Control

Solar NowNow