Article Scrapper
A simple Python library to scrape articles from the web.
Installation
pip install article_scrapper
Features
- Scrape articles: Extract title, text, authors, and publication date from any article URL
- Search articles: Find articles using DuckDuckGo search
- Pipeline: Combine search and scrape to get article content for any query
Usage
Scrape a single article
from article_scrapper import scrape_article
article = scrape_article("https://example.com/article")
print(article["title"])
print(article["text"])
print(article["authors"])
print(article["publish_date"])
Search for articles
from article_scrapper import search_articles
urls = search_articles("python programming", max_results=5)
for url in urls:
print(url)
Search and scrape articles
from article_scrapper import get_articles_for_query
articles = get_articles_for_query("artificial intelligence news", max_results=5)
for article in articles:
print(f"Title: {article['title']}")
print(f"URL: {article['url']}")
print(f"Text: {article['text'][:200]}...")
print("---")
API Reference
scrape_article(url: str) -> dict
Scrape an article from a given URL.
Parameters:
url: The URL of the article to scrape
Returns: A dictionary containing:
url: The original URLtitle: The article titletext: The full article textauthors: List of article authorspublish_date: The publication date as a string
search_articles(query: str, max_results: int = 5) -> list[str]
Search for articles using DuckDuckGo.
Parameters:
query: The search query stringmax_results: Maximum number of URLs to return (default: 5)
Returns: A list of URLs matching the search query.
get_articles_for_query(query: str, max_results: int = 5) -> list[dict]
Search for articles and scrape their content.
Parameters:
query: The search query stringmax_results: Maximum number of articles to retrieve (default: 5)
Returns:
A list of article dictionaries (same format as scrape_article).
Dependencies
- newspaper3k - Article scraping
- ddgs - DuckDuckGo search
- lxml-html-clean - HTML cleaning
License
MIT License
Metadata
Release files for article-scrapper 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| article_scrapper-0.1.0.tar.gz | 3.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| article_scrapper-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.7 kB
Release files / article_scrapper-0.1.0.tar.gz
| Download URL | article_scrapper-0.1.0.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
70cb7558dcd02a1bc2639621010f4a51c5f7ed1e3f7463aeb2b2f303e02c0bed
|
|
BLAKE2b-256 checksum How to use checksums |
ada09b050fe885792bd8a459ce2b444306268ae5abf412fb16f9efb6efe34837
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Release files / article_scrapper-0.1.0-py3-none-any.whl
| Download URL | article_scrapper-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6c00c166be9faaf0b84ceb6664e649b2696d4e0899d072694068924672460228
|
|
BLAKE2b-256 checksum How to use checksums |
0b2d1b93ba2e3c533fde64814045449ae8d1c11f1023f1de562549d78c0b94b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Security for article-scrapper 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.