# USPhoneBook Scraper in Python: Phones, Owners, Addresses > Source: https://scrape.do/blog/usphonebook-scraping/ Published: 2026-11-30 · Updated: 2026-11-30 · Authors: Raif Tekin · Categories: Scraping Use Cases > **Privacy note:** Every name, phone number, address and email on this page is a placeholder. We ran each script against live USPhoneBook pages, then swapped the personal values in the output for fictional ones. Yes, you can scrape USPhoneBook with Python, but a bare `requests.get()` won't get you anything. Cloudflare sits in front of the whole site, and in our tests it answered every direct request with a 403 "Attention Required!" page, `robots.txt` included. Send the same URL through a scraping API with a US exit IP, such as Scrape.do's [Web Scraping API](/products/web-scraping-api/), and the full page comes back for 1 credit. No headless browser. After that, the parsing is light work. USPhoneBook is a free [people search](/blog/people-scraping/) and reverse phone lookup site with no account wall, and it marks up its pages for search engines. Most fields sit in JSON-LD or schema.org microdata, not in styled text. ## What Each USPhoneBook Page Gives You for Free | Page | URL pattern | Free fields | Where the data sits | |---|---|---|---| | Reverse phone | `/{area}-{prefix}-{line}` | City, state, ZIP, carrier, line type, current owner, owner's relatives, previous owners | Microdata plus a facts table | | Profile | `/{first}-{last}/{id}` | Full name, age, birth month, current street address and ZIP, address history, all phones with line type and carrier, emails, relatives and associates | `Person` JSON-LD, plus HTML for age and line type | | Name search | `/{first}-{last}/{state}?page=N` | Name, age, current city, prior cities, relatives, profile URL | schema.org microdata on each result card | | Address | `/address/{street}_{city}-{state}` | Year built, floor size, last sale, residents with ages and profile links | `SingleFamilyResidence` and `FAQPage` JSON-LD, plus resident cards | Two pages hold something back. Search cards hide the street and phone behind a "View Full Address & Phone" button, and phone pages print "Full address available" where the owner's street would be. The button is a plain link to the profile, and the profile shows both for free. Everything in the table is in the initial HTML, so nothing waits on JavaScript. ## What Cloudflare Returns to Plain Requests Here's what each kind of request got in our tests: | Request | Result | |---|---| | Python `requests` with its default user agent | 403, Cloudflare "Attention Required!" page | | Python `requests` with a desktop Chrome user agent | 403, same page | | `curl` with a desktop Chrome user agent | 403, same page | | `robots.txt`, any of the above | 403 | | Scrape.do default request | 200, full page, 1 credit | | Scrape.do with `geoCode=us` | 200, full page, 1 credit | A browser user agent changes nothing, so this isn't the user-agent check that [AnyWho](/blog/anywho-scraping/) runs. Location isn't the trigger either. Scrape.do exits in Germany and the UK got the same 200 page as US ones, while [TruePeopleSearch](/blog/true-people-search-scraping/) adds a US geoblock on top of Cloudflare. The 403 page doesn't say which signal tripped it, so there's nothing in the response to adjust. Other people search sites block plain Python in their own ways. [PeopleSearchNow](/blog/people-search-now-scraping/) and [SearchPeopleFree](/blog/search-people-free-scraping/) return a Cloudflare 403 too, and [Radaris](/blog/radaris-scraping/) answers with Cloudflare's JavaScript challenge and spreads its profiles over state subdomains. So every script here sends its requests through Scrape.do with [`geoCode=us`](/documentation/proxies/geo-code/). The geo parameter costs nothing extra and keeps your exits in the country USPhoneBook is built for. No page in our tests needed `super=true` (premium residential proxies) or `render=true` (a headless browser), so leave both off and pay 1 credit a page. ## Setup ```bash pip install requests beautifulsoup4 ``` Each script needs a Scrape.do token: [create a free account](https://dashboard.scrape.do/signup) and paste the token from your dashboard into `token`. If `requests` or BeautifulSoup is new to you, our [Python web scraping](/blog/python-web-scraping/) guide walks through both. ## USPhoneBook Reverse Phone Lookup in Python USPhoneBook's own page title puts "Free Reverse Phone Lookup" first, and often a number is all you start with, from a lead form or a call log. The phone page gives you the line's location, carrier and type, the current owner with a link to their profile, the owner's relatives and the people who had the number before. ### The URL Is the Number The phone page URL is the 10-digit number with dashes, right after the domain: ```python # (fragment of the full script below) phone_number = "<10_digit_phone>" # e.g. 7135550142, no dashes or country code digits = "".join(ch for ch in phone_number if ch.isdigit())[-10:] target_url = f"https://www.usphonebook.com/{digits[:3]}-{digits[3:6]}-{digits[6:]}" ``` Pass `(713) 555-0142` or `+1 713 555 0142` and you end up with the same 10 digits, because `[-10:]` drops a leading country code. A number USPhoneBook has no record for returns a 404. ### Line Details From the Facts Table Unlike profiles, the phone page carries no `Person` JSON-LD. The line details sit in a two-column table of `.extra-info-item` rows, each a `._title` div followed by a value div: ```python # (fragment of the full script below) # The facts table is a list of title/value pairs: area code, city, ZIP, carrier, line type facts = {} for item in soup.select(".extra-info-item"): title = item.select_one("._title") value = title.find_next_sibling("div") if title else None facts[clean(title)] = clean(value) ``` That one loop collects Area Code, Prefix, Full Number, International Number, Country, County, City, State, Zip, Owner, Carrier and Phone Type. Some rows come back empty; County was blank on the numbers we tested. ### Current and Previous Owners The current owner is schema.org microdata: the name in `itemprop="name"` and a profile link that ends in `#DetailsPerson`. Previous owners get their own blocks lower on the page: ```python # (fragment of the full script below) # The current owner is a schema.org Person in microdata, plus a link to the full profile owner_name = clean(soup.select_one(".success-wrapper-block [itemprop='name']")) owner_link = soup.select_one('a[href$="#DetailsPerson"]') owner_url = "https://www.usphonebook.com" + owner_link["href"].split("#")[0] if owner_link else "" relatives = [clean(a.select_one("[itemprop='name']")) for a in soup.select("a[itemprop='relatedTo']")] # Previous owners sit in their own blocks below, one h3 link each previous = [clean(a) for a in soup.select(".previous-results h3 a")] ``` The phone page won't show the owner's street ("Full address available"). `owner_url` is how you get it. Feed it to the profile script below, and for 1 more credit you have the street, ZIP, emails and every other number. ### Full Phone Lookup Script ```python import requests from bs4 import BeautifulSoup token = "" phone_number = "<10_digit_phone>" # e.g. 7135550142, no dashes or country code digits = "".join(ch for ch in phone_number if ch.isdigit())[-10:] target_url = f"https://www.usphonebook.com/{digits[:3]}-{digits[3:6]}-{digits[6:]}" response = requests.get("https://api.scrape.do/", params={"token": token, "url": target_url, "geoCode": "us"}) # A number USPhoneBook has no record for comes back as a 404 if response.status_code == 404: raise SystemExit("No record for this number") if response.status_code != 200: raise SystemExit(f"Request failed with status {response.status_code}") soup = BeautifulSoup(response.text, "html.parser") def clean(element): return " ".join(element.get_text(" ").split()).strip(" ,") if element else "" # The facts table is a list of title/value pairs: area code, city, ZIP, carrier, line type facts = {} for item in soup.select(".extra-info-item"): title = item.select_one("._title") value = title.find_next_sibling("div") if title else None facts[clean(title)] = clean(value) # The current owner is a schema.org Person in microdata, plus a link to the full profile owner_name = clean(soup.select_one(".success-wrapper-block [itemprop='name']")) owner_link = soup.select_one('a[href$="#DetailsPerson"]') owner_url = "https://www.usphonebook.com" + owner_link["href"].split("#")[0] if owner_link else "" relatives = [clean(a.select_one("[itemprop='name']")) for a in soup.select("a[itemprop='relatedTo']")] # Previous owners sit in their own blocks below, one h3 link each previous = [clean(a) for a in soup.select(".previous-results h3 a")] print(f"Phone: {facts.get('Full Number', '')}") print(f"Phone Type: {facts.get('Phone Type', '')}") print(f"Carrier: {facts.get('Carrier', '')}") print(f"Location: {facts.get('City', '')}, {facts.get('State', '')} {facts.get('Zip', '')}") print(f"Owner: {owner_name}") print(f"Owner Profile: {owner_url}") print(f"Owner Relatives: {', '.join(relatives[:5])}") print(f"Previous Owners: {', '.join(previous)}") ``` A live lookup, with placeholder values: ```plaintext Phone: 713-555-0142 Phone Type: Wireless Carrier: T-Mobile USA Inc Location: Houston, TX 77001 Owner: Jane Doe Owner Profile: https://www.usphonebook.com/jane-doe/U0000000000000000000000000 Owner Relatives: John Doe, Mary Doe, Richard Roe, Jane Roe, Joe Public Previous Owners: Richard Roe, John Q Public, Mary Major ``` Keep the previous owners for list hygiene. If your CRM still ties this number to Richard Roe, the lookup tells you it belongs to someone else now, before anyone dials it. ## Full Records From a USPhoneBook Profile Most paths on USPhoneBook end at a profile: the phone page's `owner_url`, every search card and every resident on an address page link to one. It's also the richest page, with up to 10 fields from one request, including the street, phones and emails the other pages hold back. Profile URLs look like `/jane-doe/U0000000000000000000000000`. ### One Person JSON-LD Block Holds the Record Each profile embeds four JSON-LD blocks: `WebSite`, `Organization`, `BreadcrumbList` and `Person`. Only `Person` matters here: ```python # (fragment of the full script below) # The profile ships one Person JSON-LD block with the whole record person = {} for script in soup.find_all("script", type="application/ld+json"): try: data = json.loads(script.string) except (TypeError, json.JSONDecodeError): continue if isinstance(data, dict) and data.get("@type") == "Person": person = data break ``` Trimmed to one entry per list, with placeholder values, the block looks like this: ```json { "@type": "Person", "url": "https://www.usphonebook.com/jane-doe/U0000000000000000000000000", "name": "Jane Doe", "givenName": "Jane", "familyName": "Doe", "homeLocation": { "@type": "Place", "description": "Current home address", "address": {"@type": "PostalAddress", "streetAddress": "1234 Example Ln", "addressLocality": "Houston", "addressRegion": "TX", "postalCode": "77001"} }, "address": [{"@type": "PostalAddress", "streetAddress": "1234 Example Ln", "addressLocality": "Houston", "addressRegion": "TX", "postalCode": "77001"}], "relatedTo": [{"@type": "Person", "url": "https://www.usphonebook.com/john-doe/U1111111111111111111111111", "name": "John Doe"}], "email": ["jane.doe@example.com"], "telephone": ["(713) 555-0142"] } ``` `homeLocation` is the current address. It's also the first entry in `address`, so the rest of that list is the address history. The first `telephone` entry is the number the page shows as "Current Phone Number". ### Phones, Emails, Past Addresses and Relatives Two small helpers keep the field code short. `as_list()` handles a field that holds one string instead of a list, and `format_address()` flattens a `PostalAddress` into one line: ```python # (fragment of the full script below) def as_list(value): return value if isinstance(value, list) else [value] if value else [] def format_address(address): street = address.get("streetAddress", "") city = address.get("addressLocality", "") return f"{street}, {city}, {address.get('addressRegion', '')} {address.get('postalCode', '')}".strip(", ") current = person.get("homeLocation", {}).get("address", {}) phones = as_list(person.get("telephone")) emails = as_list(person.get("email")) past_addresses = [format_address(a) for a in as_list(person.get("address"))[1:]] # relatedTo mixes relatives and associates and repeats some, so dedupe by profile URL related = {r.get("url"): r.get("name", "") for r in as_list(person.get("relatedTo"))} ``` Read the emails here, not from the HTML. The visible page runs them through [Cloudflare's email obfuscation](https://developers.cloudflare.com/waf/tools/scrape-shield/email-address-obfuscation/), so the markup holds `[email protected]` and an encoded `data-cfemail` attribute. The JSON-LD lists them in plain text, as [FastPeopleSearch](/blog/fast-people-search-scraping/) does. `relatedTo` merges the "Relatives" and "Associates" sections, and some people appear in both. Keying the dict on profile URL leaves one entry per person. > Every value shown here is fictional, but the phones, addresses and emails your scraper collects belong to real people. USPhoneBook says it is not a consumer reporting agency under the FCRA and that its data can't be used for employment, credit or tenant screening, so keep scraped records out of those decisions. Don't call or text scraped numbers for marketing without consent, honor opt-out requests, and follow the privacy laws that apply to you. ### Age, Line Type and Carrier Come From the HTML Three fields never made it into the JSON-LD. Age is in the summary line under the `h1` ("47 years old, March 1979"), and the current number's line type and carrier sit beside it in the phone section: ```python # (fragment of the full script below) # Age is not in the JSON-LD, so it comes from the summary line under the h1 age_line = soup.select_one(".ls_contacts__age") match = re.search(r"(\d+) years old", age_line.get_text()) if age_line else None age = match.group(1) if match else "" # Line type and carrier for the current number only appear in the HTML phone_type = soup.select_one(".phone-sub-category") carrier = phone_type.find_next_sibling("span") if phone_type else None ``` A profile without an age line gives you an empty string, not a crash. The `phone-sub-category` span reads "Wireless", "Landline" or "Voip", and the carrier is the `` after it. ### Full Profile Script ```python import json import re import requests from bs4 import BeautifulSoup token = "" target_url = "" # e.g. https://www.usphonebook.com/jane-doe/U0000000000000000000000000 response = requests.get("https://api.scrape.do/", params={"token": token, "url": target_url, "geoCode": "us"}) if response.status_code != 200: raise SystemExit(f"Request failed with status {response.status_code}") soup = BeautifulSoup(response.text, "html.parser") # The profile ships one Person JSON-LD block with the whole record person = {} for script in soup.find_all("script", type="application/ld+json"): try: data = json.loads(script.string) except (TypeError, json.JSONDecodeError): continue if isinstance(data, dict) and data.get("@type") == "Person": person = data break def as_list(value): return value if isinstance(value, list) else [value] if value else [] def format_address(address): street = address.get("streetAddress", "") city = address.get("addressLocality", "") return f"{street}, {city}, {address.get('addressRegion', '')} {address.get('postalCode', '')}".strip(", ") # Age is not in the JSON-LD, so it comes from the summary line under the h1 age_line = soup.select_one(".ls_contacts__age") match = re.search(r"(\d+) years old", age_line.get_text()) if age_line else None age = match.group(1) if match else "" # Line type and carrier for the current number only appear in the HTML phone_type = soup.select_one(".phone-sub-category") carrier = phone_type.find_next_sibling("span") if phone_type else None current = person.get("homeLocation", {}).get("address", {}) phones = as_list(person.get("telephone")) emails = as_list(person.get("email")) past_addresses = [format_address(a) for a in as_list(person.get("address"))[1:]] # relatedTo mixes relatives and associates and repeats some, so dedupe by profile URL related = {r.get("url"): r.get("name", "") for r in as_list(person.get("relatedTo"))} print(f"Name: {person.get('name', '')}") print(f"Age: {age}") print(f"Address: {format_address(current)}") print(f"Phone: {phones[0] if phones else ''}") print(f"Phone Type: {phone_type.get_text(strip=True) if phone_type else ''}") print(f"Carrier: {carrier.get_text(strip=True) if carrier else ''}") print(f"Other Phones: {len(phones[1:])}") print(f"Email: {emails[0] if emails else ''}") print(f"Past Addresses: {' | '.join(past_addresses[:3])}") print(f"Relatives and Associates: {', '.join(list(related.values())[:5])}") ``` The prints stop at 3 past addresses and 5 relatives; the lists behind them keep everything. Output from a live run, placeholders swapped in: ```plaintext Name: Jane Doe Age: 47 Address: 1234 Example Ln, Houston, TX 77001 Phone: (713) 555-0142 Phone Type: Wireless Carrier: T-mobile Usa Inc Other Phones: 11 Email: jane.doe@example.com Past Addresses: 55 Sample St, Houston, TX 77002 | 900 Placeholder Ave Apt 12, Humble, TX 77338 | 42 Test Rd, Spring, TX 77373 Relatives and Associates: John Doe, Mary Doe, Richard Roe, Jane Roe, Joe Public ``` A profile can list a dozen numbers. Some may have changed hands since, so check the ones you plan to call with the phone script, which names each number's current owner. Carrier names keep USPhoneBook's own casing; normalize them before you group by carrier. ## Search USPhoneBook by Name, Minus the Near Matches Name search is how you build the list of profiles in the first place: 10 people per page, each with age, current city, prior cities, relatives and a profile URL. The catch is padding. USPhoneBook mixes in people you didn't search for, so the script checks every card. ### The Search URL Takes a State Name or Code Search URLs are the first and last name joined by a hyphen, then an optional state: ```python # (fragment of the full script below) next_url = f"https://www.usphonebook.com/{first_name}-{last_name}" + (f"/{state}" if state else "") next_url = next_url.lower().replace(" ", "%20") ``` `texas` and `tx` both work as the state, and so do `new%20york` and `ny`. A hyphenated `new-york` returns a 404, which is why the code encodes the space instead. Leave `state` empty for a nationwide search. ### Each Card Is Schema.org Microdata Search results have no `Person` JSON-LD. Each card is a schema.org `Person` in microdata, with the profile URL in `itemid`: ```html

Jane A Doe, Age 47

Lives in: Houston, TX
Relatives: John Doe,
``` Parse the `itemprop` attributes rather than the class names around them. They're schema.org vocabulary, so a restyle is less likely to touch them. Each row starts with a text label, and the loop uses that label as the field name: ```python # (fragment of the full script below) for card in soup.select('div.success-wrapper-block[itemtype="https://schema.org/Person"]'): name = clean(card.select_one("h3 [itemprop='name']")) _, _, age = clean(card.select_one("h3")).rpartition("Age ") # Rows start with a text label ("Lives in:", "Prior addresses:", "Relatives:") fields = {} for row in card.select(".ls_success-content-extra-info"): label = row.find(string=True, recursive=False) or "" if "Relatives" in label: values = [clean(a.select_one("[itemprop='name']")) for a in row.select("a[itemprop='relatedTo']")] else: values = [clean(el) for el in row.select("[itemprop='address']")] fields[label.strip().rstrip(":")] = " | ".join(values) ``` `row.find(string=True, recursive=False)` returns only the row's own first text node ("Lives in:" or "Relatives:"), not the names nested inside it. A card with no "Prior addresses:" row never gets that entry, and `fields.get()` fills in an empty string later. ### Filter Out the Near Matches A John Smith search in Texas came back with Jamies, Jonathans and other surnames mixed in. The "in Texas" part is loose as well: it matches anyone with a Texas address anywhere in their history, so many cards show a current city in another state. Compare both names before you keep a card: ```python # (fragment of the full script below) # Near matches (other first or last names) share the list, so compare both names words = name.lower().split() if exact_only and (not words or words[0] != first_name or words[-1] != last_name): continue ``` Checking only the first and last word lets middle names through ("Jane A Doe" passes). Set `exact_only = False` if you want USPhoneBook's fuzzy matches, for example to catch nicknames. ### Paginate Until "Next Page" Disappears The page title states the total ("N Public Records Found for John Smith in TX"), and every page except the last ends with a "Next Page" link: ```python # (fragment of the full script below) next_link = soup.select_one('.ls_success-pagination a[title="Next Page"]') next_url = "https://www.usphonebook.com" + next_link["href"] if next_link else None ``` A page past the end returns a 404, and so does a name with no matches at all. Scrape.do passes the 404 through, and the script stops there. ### Full Search Script With CSV Export The script writes six columns to `usphonebook-search-results.csv`. Keep `newline=""`: on Windows, the `csv` module otherwise leaves a blank line between rows. ```python import csv import requests from bs4 import BeautifulSoup token = "" first_name = "jane" last_name = "doe" state = "texas" # state name or two-letter code ("new york", "ny"), or "" for nationwide exact_only = True # drop the near matches USPhoneBook mixes into the results next_url = f"https://www.usphonebook.com/{first_name}-{last_name}" + (f"/{state}" if state else "") next_url = next_url.lower().replace(" ", "%20") def clean(element): return " ".join(element.get_text(" ").split()).strip(" ,") if element else "" rows = [] page = 1 max_pages = 30 # 10 results per page; the loop also stops on the last page while next_url and page <= max_pages: response = requests.get("https://api.scrape.do/", params={"token": token, "url": next_url, "geoCode": "us"}) # A name with no matches, or a page past the last one, comes back as a 404 if response.status_code == 404: print("No more results") break if response.status_code != 200: print(f"Request failed with status {response.status_code}") break soup = BeautifulSoup(response.text, "html.parser") # Each result card is a schema.org Person in microdata, with its profile URL in itemid for card in soup.select('div.success-wrapper-block[itemtype="https://schema.org/Person"]'): name = clean(card.select_one("h3 [itemprop='name']")) _, _, age = clean(card.select_one("h3")).rpartition("Age ") # Near matches (other first or last names) share the list, so compare both names words = name.lower().split() if exact_only and (not words or words[0] != first_name or words[-1] != last_name): continue # Rows start with a text label ("Lives in:", "Prior addresses:", "Relatives:") fields = {} for row in card.select(".ls_success-content-extra-info"): label = row.find(string=True, recursive=False) or "" if "Relatives" in label: values = [clean(a.select_one("[itemprop='name']")) for a in row.select("a[itemprop='relatedTo']")] else: values = [clean(el) for el in row.select("[itemprop='address']")] fields[label.strip().rstrip(":")] = " | ".join(values) rows.append([name, age, fields.get("Lives in", ""), fields.get("Prior addresses", ""), fields.get("Relatives", ""), card["itemid"]]) next_link = soup.select_one('.ls_success-pagination a[title="Next Page"]') next_url = "https://www.usphonebook.com" + next_link["href"] if next_link else None print(f"Page {page}: {len(rows)} results so far") page += 1 with open("usphonebook-search-results.csv", "w", newline="", encoding="utf-8") as f: writer = csv.writer(f) writer.writerow(["name", "age", "lives_in", "prior_addresses", "relatives", "profile_url"]) writer.writerows(rows) print(f"Saved {len(rows)} results to usphonebook-search-results.csv") ``` Exact matches don't always come first. In this run, a Jane Doe search in Texas, the first four pages added no rows at all: ```plaintext Page 1: 0 results so far Page 2: 0 results so far Page 3: 0 results so far Page 4: 0 results so far Page 5: 4 results so far Page 6: 8 results so far Page 7: 15 results so far Page 8: 24 results so far Saved 24 results to usphonebook-search-results.csv ``` That's why `max_pages` is high. The loop stops by itself when the "Next Page" link disappears, and a cap of 3 or 4 would have quit before the first exact match. Here's the first row it wrote, with placeholder values: ```plaintext Jane A Doe,47,"Houston, TX","Houston, TX | Humble, TX | Spring, TX",John Doe | Mary Doe | Richard Roe,https://www.usphonebook.com/jane-doe/U0000000000000000000000000 ``` Each `profile_url` is an input for the profile script. To reach more people than one search returns, run the search once per state. ## USPhoneBook Address Lookup Every address on a profile links to an address page: property facts, the last sale, and the people who live or lived there, each with an age and a profile link. ### Rebuild the Address URL From a Street Address pages live at `/address/{street}_{city}-{state}`, in lowercase, with words joined by hyphens and an underscore between street and city: ```python # (fragment of the full script below) def slug(text): # USPhoneBook writes "PO Box" as "pobox" in its URLs text = text.lower().replace("po box", "pobox") return "-".join(re.sub(r"[^a-z0-9 ]", " ", text).split()) # Address pages live at /address/{street}_{city}-{state} target_url = f"https://www.usphonebook.com/address/{slug(street)}_{slug(city)}-{state.lower()}" ``` So "1234 Example Ln Apt 5, Houston, TX" becomes `/address/1234-example-ln-apt-5_houston-tx`. In our tests, this function rebuilt the site's own address links from profile JSON-LD. PO boxes were the exception until we added the `pobox` rule. ### Property JSON-LD and Resident Cards Address pages go back to JSON-LD, two blocks this time. `SingleFamilyResidence` holds the property facts, and `FAQPage` answers "Who lives at..." and "Is this property currently for sale?" in plain sentences: ```python # (fragment of the full script below) # Property facts sit in a SingleFamilyResidence JSON-LD block, owner and sale answers in a FAQPage block home, faq = {}, {} for script in soup.find_all("script", type="application/ld+json"): try: data = json.loads(script.string) except (TypeError, json.JSONDecodeError): continue if isinstance(data, dict) and data.get("@type") == "SingleFamilyResidence": home = data elif isinstance(data, dict) and data.get("@type") == "FAQPage": faq = {q.get("name", ""): q.get("acceptedAnswer", {}).get("text", "") for q in data.get("mainEntity", [])} ``` Residents are `h3` cards under the "People Living at" heading. Each one links to the person's free profile, the same handoff the phone page's `owner_url` gives you: ```python # (fragment of the full script below) residents = [] heading = soup.find(lambda tag: tag.name == "h2" and tag.get_text().startswith("People Living at")) for h3 in heading.find_all_next("h3", class_="ls_number-text") if heading else []: link = h3.find("a") if not link: continue residents.append({ "name": clean(link.find_all("span")[-1]), "age": clean(h3.select_one(".age")).replace("Age", "").strip(" ,"), "lives_at": clean(h3.parent.select_one(".livesAt a")), "profile_url": "https://www.usphonebook.com" + link["href"], }) ``` The last `` in each link holds the full name, middle name included. `lives_at` is where that person lives now, which isn't always this address: past residents stay on the list. ### Full Address Script ```python import json import re import requests from bs4 import BeautifulSoup token = "" street, city, state = "", "", "" # e.g. "1234 Example Ln", "Houston", "TX" def slug(text): # USPhoneBook writes "PO Box" as "pobox" in its URLs text = text.lower().replace("po box", "pobox") return "-".join(re.sub(r"[^a-z0-9 ]", " ", text).split()) # Address pages live at /address/{street}_{city}-{state} target_url = f"https://www.usphonebook.com/address/{slug(street)}_{slug(city)}-{state.lower()}" response = requests.get("https://api.scrape.do/", params={"token": token, "url": target_url, "geoCode": "us"}) if response.status_code != 200: raise SystemExit(f"Request failed with status {response.status_code}") soup = BeautifulSoup(response.text, "html.parser") def clean(element): return " ".join(element.get_text(" ").split()).strip(" ,") if element else "" # Property facts sit in a SingleFamilyResidence JSON-LD block, owner and sale answers in a FAQPage block home, faq = {}, {} for script in soup.find_all("script", type="application/ld+json"): try: data = json.loads(script.string) except (TypeError, json.JSONDecodeError): continue if isinstance(data, dict) and data.get("@type") == "SingleFamilyResidence": home = data elif isinstance(data, dict) and data.get("@type") == "FAQPage": faq = {q.get("name", ""): q.get("acceptedAnswer", {}).get("text", "") for q in data.get("mainEntity", [])} # Residents are h3 cards under the "People Living at" heading, each linking to a free profile residents = [] heading = soup.find(lambda tag: tag.name == "h2" and tag.get_text().startswith("People Living at")) for h3 in heading.find_all_next("h3", class_="ls_number-text") if heading else []: link = h3.find("a") if not link: continue residents.append({ "name": clean(link.find_all("span")[-1]), "age": clean(h3.select_one(".age")).replace("Age", "").strip(" ,"), "lives_at": clean(h3.parent.select_one(".livesAt a")), "profile_url": "https://www.usphonebook.com" + link["href"], }) # The owner card repeats at the end of the list, so dedupe by profile URL residents = list({r["profile_url"]: r for r in residents}.values()) print(f"Address: {home.get('name', '')}, {home.get('address', {}).get('addressLocality', '')}") print(f"Year Built: {home.get('yearBuilt', '')}") print(f"Floor Size: {home.get('floorSize', {}).get('value', '')} {home.get('floorSize', {}).get('unitCode', '')}") for question, answer in faq.items(): if question.startswith(("Who lives", "Is this property")): print(f"{question} {answer}") print(f"Residents: {len(residents)}") for r in residents[:3]: print(f"- {r['name']}, {r['age']} | lives at: {r['lives_at']} | {r['profile_url']}") ``` Output for a placeholder address: ```plaintext Address: 1234 Example Ln, Houston Year Built: 1995 Floor Size: 1700 FTK Who lives at 1234 Example Ln, Houston, TX 77001? According to our records, the current person living in 1234 Example Ln is Jane Doe. Is this property currently for sale? The property is not for sale and last sold for $210,000 on Mar 12, 2020. Use USPhoneBook to review nearby listings or compare similar homes in the area. Residents: 4 - Jane A Doe, 47 | lives at: 1234 Example Ln, Houston, TX 77001-0000 | https://www.usphonebook.com/jane-doe/U0000000000000000000000000 - John Doe, 49 | lives at: 1234 Example Ln, Houston, TX 77001-0000 | https://www.usphonebook.com/john-doe/U1111111111111111111111111 - Richard Roe, 63 | lives at: 42 Test Rd, Spring, TX 77373-0000 | https://www.usphonebook.com/richard-roe/U2222222222222222222222222 ``` `FTK` is the UN/CEFACT code for square feet. On a multi-unit building, `floorSize` covers the whole building, not one apartment. An address USPhoneBook has no record for still returns a 200, with empty property facts and no residents. Check `residents` before you count the page as a hit. ## From a Search CSV to Full Profiles For hundreds of people, chain two of the scripts. The search CSV supplies profile URLs, and a thread pool fetches the profiles five at a time. Server errors and timeouts get retried; a 404 means the profile is gone, so the script records it and moves on. ```python import csv import json from concurrent.futures import ThreadPoolExecutor import requests from bs4 import BeautifulSoup token = "" def fetch_person(profile_url): # Retry server errors and timeouts; a 404 means the record is gone, so stop there status = None for attempt in range(3): try: response = requests.get("https://api.scrape.do/", params={"token": token, "url": profile_url, "geoCode": "us"}, timeout=60) status = response.status_code except requests.RequestException: continue if status in (200, 404): break if status != 200: return {"profile_url": profile_url, "error": status} soup = BeautifulSoup(response.text, "html.parser") for script in soup.find_all("script", type="application/ld+json"): try: data = json.loads(script.string) except (TypeError, json.JSONDecodeError): continue if isinstance(data, dict) and data.get("@type") == "Person": current = data.get("homeLocation", {}).get("address", {}) return { "profile_url": profile_url, "name": data.get("name", ""), "street": current.get("streetAddress", ""), "city": current.get("addressLocality", ""), "state": current.get("addressRegion", ""), "zip": current.get("postalCode", ""), "phones": data.get("telephone") or [], "emails": data.get("email") or [], } return {"profile_url": profile_url, "error": "no Person JSON-LD"} with open("usphonebook-search-results.csv", encoding="utf-8") as f: urls = [row["profile_url"] for row in csv.DictReader(f)] # Keep max_workers at or under the concurrency limit of your Scrape.do plan with ThreadPoolExecutor(max_workers=5) as pool: people = list(pool.map(fetch_person, urls)) with open("usphonebook-people.jsonl", "w", encoding="utf-8") as f: for person in people: f.write(json.dumps(person) + "\n") print(f"Saved {len(people)} profiles, {sum('error' in p for p in people)} errors") ``` `usphonebook-people.jsonl` gets one person per line, with phones and emails as lists, so it loads straight into a database. In our runs, profile requests came back 200 at 1 credit each. Some profiles have no phone or email, though, so check for empty lists before you count a record as a lead. On a big run, dedupe the profile URLs before you fetch: the same person turns up in several searches and as a relative on other profiles. Save the raw HTML for a sample of pages, so a renamed class costs you a parser fix instead of a second crawl. And keep only the fields you'll use. A lead list rarely needs relatives or address history, and a record you never stored is one you never have to delete when its owner opts out. ## Which Script to Start From Start from what you already have. A list of phone numbers goes through the phone script, and only the owners you care about go on to the profile script, so you pay 1 credit per number plus 1 per profile. A list of names goes through the search script with `exact_only = True`, and its CSV feeds the scale script. Address pages answer a different question, who lives at a property, and their resident links feed the same profile script. Whichever you pick, plan for records going stale. People keep opting out after you collect them, so re-check stored records against the live pages on a schedule. [Get 1000 free credits and start scraping with Scrape.do](https://dashboard.scrape.do/signup) ## FAQ ### Is USPhoneBook Free? Yes, for everything this guide scrapes. None of the four page types asks for an account or a payment. The paid part is the "Full Background Report" buttons, which send you to paid reports on partner sites such as PeopleFinders. ### Does USPhoneBook Have an API? We found no public API documentation on USPhoneBook. The data is in server-rendered HTML, with JSON-LD on profile and address pages and microdata on search and phone pages, so parsing those pages is the practical route. ### Is It Legal to Scrape USPhoneBook? Not legal advice, but here is the short version (our [web scraping legality](/blog/web-scraping-legality/) guide has the long one). With USPhoneBook, what you do with the records matters as much as how you collect them. Its [terms](https://www.usphonebook.com/terms) rule out using the data for employment, credit or tenant screening, because the site is not a consumer reporting agency under the [Fair Credit Reporting Act](https://www.ftc.gov/legal-library/browse/statutes/fair-credit-reporting-act). The records are also personal data: if you're in the EU or the UK, or the GDPR covers your use, you need a lawful basis, a clear purpose and a way to honor deletion requests. On access, the Ninth Circuit held in [hiQ v. LinkedIn](https://cdn.ca9.uscourts.gov/datastore/opinions/2022/04/18/17-16783.pdf) (2022) that scraping public pages likely isn't access "without authorization" under the CFAA. hiQ still lost later, on breach of contract. ### How Do I Remove My Information From USPhoneBook? Go to [usphonebook.com/opt-out](https://www.usphonebook.com/opt-out), which redirects to the removal page, or open your profile and click "Remove Record" under the age line. You enter your name and email, USPhoneBook emails you a link to the removal form, and the page asks you to allow 3 days for processing.