VOOZH about

URL: https://apify.com/krishnapada.m.99/single-page-web-scraping

⇱ Single page web scraping Β· Apify


Pricing

$0.01 / 1,000 results

Go to Apify Store

Single page web scraping

Scrapes the <title> tag or H1 tag from a single webpage provided by the user. Useful for SEO audits or content previews.

Pricing

$0.01 / 1,000 results

Rating

0.0

(0)

Developer

πŸ‘ Somnath Mandal

Somnath Mandal

Maintained by Community

Actor stats

0

Bookmarked

63

Total users

3

Monthly active users

5 months ago

Last modified

Share

Scrape single-page in Python template

A template for web scraping data from a single web page in Python. The URL of the web page is passed in via input, which is defined by the input schema. The template uses the HTTPX to get the HTML of the page and the Beautiful Soup to parse the data from it. The data are then stored in a dataset where you can easily access them.

The scraped data in this template are page headings but you can easily edit the code to scrape whatever you want from the page.

Included features

  • Apify SDK for Python - a toolkit for building Apify Actors and scrapers in Python
  • Input schema - define and easily validate a schema for your Actor's input
  • Request queue - queues into which you can put the URLs you want to scrape
  • Dataset - store structured data where each object stored has the same attributes
  • HTTPX - library for making asynchronous HTTP requests in Python
  • Beautiful Soup - library for pulling data out of HTML and XML files

How it works

  1. Actor.get_input() gets the input where the page URL is defined
  2. httpx.AsyncClient().get(url) fetches the page
  3. BeautifulSoup(response.content, 'lxml') loads the page data and enables parsing the headings
  4. This parses the headings from the page and here you can edit the code to parse whatever you need from the page
    for heading in soup.find_all(["h1","h2","h3","h4","h5","h6"]):
  5. Actor.push_data(headings) stores the headings in the dataset

Resources

Getting started

For complete information see this article. In short, you will:

  1. Build the Actor
  2. Run the Actor

Pull the Actor for local development

If you would like to develop locally, you can pull the existing Actor from Apify console using Apify CLI:

  1. Install apify-cli

    Using Homebrew

    $brew install apify-cli

    Using NPM

    $npm-ginstall apify-cli
  2. Pull the Actor by its unique <ActorId>, which is one of the following:

    • unique name of the Actor to pull (e.g. "apify/hello-world")
    • or ID of the Actor to pull (e.g. "E2jjCZBezvAZnX8Rb")

    You can find both by clicking on the Actor title at the top of the page, which will open a modal containing both Actor unique name and Actor ID.

    This command will copy the Actor into the current directory on your local machine.

    $apify pull <ActorId>

Documentation reference

To learn more about Apify and Actors, take a look at the following resources:

You might also like

Website Content Crawler Fast

timelody/website-content-crawler-fast

Scraping data from every single web page.

Simple SEO Data Extractor

onescales/simple-seo-data-extractor

Grab SEO data from any webpage / URL and export the URL, Title Tag, Meta Description, Meta Keywords, Status Code, H1, H2, Canonical Tag and Meta Robots easily. Run the scraper for 1-100,000 pages. Run one time or on schedule or via API and Get an SEO Report for Any Site.

465

5.0

Meta Tag Audit

zerobreak/meta-tag-audit

Meta tag audit tool that reads title tags, meta descriptions, Open Graph fields, and Twitter Cards from any webpage, returning character counts, length checks, and a 0-100 SEO score per page.

Title Tag Analyzer

zerobreak/title-tag-analyzer

Title tag analyzer that checks page titles and meta descriptions across any list of URLs, so SEO teams can catch missing or oversized tags before rankings slip.

Web Images Scraper

jupri/web-images-scraper

Scrape Images from a Webpage

Related articles

What is web scraping?
Read more
How to scrape a website (ultimate guide for 2025)
Read more
Scraping single-page applications with Playwright
Read more