A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.apify.com/sdk/python below:

SDK for Python | Apify Documentation

For example, the Apify SDK makes it easy to read the Actor input with the Actor.get_input() method, and to save scraped data from your Actors to a dataset by simply using the Actor.push_data() method.

import httpx
from bs4 import BeautifulSoup

from apify import Actor


async def main() -> None:
async with Actor:
actor_input = await Actor.get_input()
async with httpx.AsyncClient() as client:
response = await client.get(actor_input['url'])
soup = BeautifulSoup(response.content, 'html.parser')
data = {'url': actor_input['url'], 'title': soup.title.string if soup.title else None}
await Actor.push_data(data)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4