Skip to main content

NewsDataScrapper

Python package that helps you easily retrieve complete web articles.

License: MIT pypi: newsdatascraper

Requirements

Installation

pip3 install newsdatascraper

Usage

from newsdatascraper import Scraper
#To first get a single article on a topic
new_scraper = Scraper('mock-api-key')
articles = new_scraper.fetch_all_articles(query='two sigma', pageSize = 10)

"""
We support two APIs: NewsApi and GNewsApi
To control the API being used change the argument of mode to either 'NEWSPAPER' or 'GNEWS'
"""

new_scraper = Scraper('mock-api-key', mode = 'GNEWS')
articles = new_scraper.fetch_all_articles(query='two sigma', pageSize = 10, 
              dateFrom = "2019-08-04", dateTo = "2019-08-10")

#To access individual articles and their properties
first_article = articles.articles[0]
print(first_article.content)
#We also provide helper functions to serialize the data
articles.toCsv('test.csv')
articles.toPickle('test.pickle')
articles.toJson()

Important Note

Please look at rate limits in the APIs to determine your prefered usage

Working on the Project

Run format

black .

Run Linter

pylama -o setup.cfg .

Run tests

pytest

Run tests + code coverage

sh ./scripts/generate_coverage.sh

Metadata

Release files for newsdatascraper 0.0.9.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for newsdatascraper 0.0.9.4
File Size Uploaded
newsdatascraper-0.0.9.4.tar.gz 4.7 kB Details

Release files / newsdatascraper-0.0.9.4.tar.gz

Download URL newsdatascraper-0.0.9.4.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
93b7103982d2c36382c5e262b99e3a9d97a8ce86c83f12c457acc2122e613b4e
BLAKE2b-256 checksum
How to use checksums
01dc3b3c06086de0da9d11539c8dc3792db13f5ec8bfdb6f76edda0a87385b39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4

Release history Release notifications | RSS feed

This release

0.0.9.4 This release

1 release file

0.0.9.3

1 release file

0.0.9.1

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page