Skip to main content

A simple Yahoo Finance news scraper

Project description

SimpleYNews

SimpleYNews is a Python package that offers a simple way to scrape financial news from Yahoo! Finance for given stock tickers. It aims to provide functionality similar to the news property of yfinance's Ticker objects.

*** IMPORTANT LEGAL DISCLAIMER ***


Yahoo!, Y!Finance, and Yahoo! finance are registered trademarks of Yahoo, Inc.

SimpleYNews is not affiliated, endorsed, or vetted by Yahoo, Inc. It's an open-source tool that uses Yahoo's publicly available APIs, and is intended for research and educational purposes only.

You should refer to Yahoo!'s terms of use (here, here, and here) for details on your rights to use the actual data downloaded. Remember - the Yahoo! finance API is intended for personal use only.

The developers of SimpleYNews are not responsible for the accuracy, completeness, or timeliness of the data provided. Users of this package are solely responsible for verifying any information before relying on it.

The method of data retrieval used by SimpleYNews may not be in compliance with Yahoo's terms of service. Users are advised to review these terms and use this package at their own risk.

By using SimpleYNews, you agree that the developers shall not be held liable for any direct, indirect, incidental, special, consequential or exemplary damages resulting from the use of this package or the data it retrieves.

Installation

Install SimpleYNews using pip:

pip install simpleynews

Quick Start

from simpleynews import SimpleYNews

# Get news for a single ticker
aapl = SimpleYNews.Ticker("AAPL")
apple_news = aapl.news

# Print the results
print("News for AAPL:")
for item in apple_news:
    print(f"Title: {item['title']}")
    print(f"Link: {item['link']}")
    print(f"Publisher: {item['publisher']}")
    print(f"Publish Time: {item['providerPublishTime']}")
    print(f"Type: {item['type']}")
    print(f"Related Tickers: {item['relatedTickers']}")
    print("---")

# Get news for multiple tickers
tickers = ["GOOGL", "MSFT"]
for ticker in tickers:
    news = SimpleYNews.Ticker(ticker).news
    print(f"\nNews for {ticker}:")
    for item in news:
        print(f"Title: {item['title']}")
        print(f"Link: {item['link']}")
        print(f"Publisher: {item['publisher']}")
        print(f"Publish Time: {item['providerPublishTime']}")
        print("---")

Features

  • Scrape latest news for given stock tickers from Yahoo! Finance
  • Simple and intuitive API similar to yfinance
  • Caching of news data to reduce repeated requests
  • Logging for better debugging and monitoring

Data Structure

Each news item is a dictionary with the following keys:

  • uuid: Unique identifier for the news item
  • title: Title of the news article
  • link: URL to the full article
  • publisher: Name of the news publisher
  • providerPublishTime: Timestamp of when the article was published
  • type: Type of the news item (usually 'STORY')
  • relatedTickers: List of stock tickers related to the news item
  • thumbnail: Dictionary containing thumbnail information (if available)
  • summary: Brief summary of the article (if available)

Limitations

  • SimpleYNews scrapes data from Yahoo! Finance's website, which may change without notice. This could break the functionality of the package.
  • The package does not provide real-time data. There may be delays in when news is published and when it becomes available through this package.
  • Due to the nature of web scraping, this package may be slower than official APIs.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

SimpleYNews is distributed under the Apache License 2.0. See the LICENSE file for details.

Disclaimer

SimpleYNews is not affiliated, endorsed, or vetted by Yahoo, Inc. It's an open-source tool that uses Yahoo's publicly available APIs, and is intended for research and educational purposes only. You should refer to Yahoo!'s terms of use for details on your rights to use the actual data downloaded.

The developers of SimpleYNews make no warranties about the completeness, reliability, and accuracy of this information. Any action you take upon the information you find on this package is strictly at your own risk. The developers will not be liable for any losses and/or damages in connection with the use of SimpleYNews.

Acknowledgments

This project is inspired by the yfinance package and aims to provide similar functionality for news retrieval. We are grateful to the developers of yfinance for their work in making financial data more accessible to the Python community.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simpleynews-0.3.1.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simpleynews-0.3.1-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file simpleynews-0.3.1.tar.gz.

File metadata

  • Download URL: simpleynews-0.3.1.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for simpleynews-0.3.1.tar.gz
Algorithm Hash digest
SHA256 bf5105c56c987e9854f065740ebef31b30ab063a82cf6a2815bca8e644907181
MD5 506ffe31108c5d065c57990a3e2b1bd5
BLAKE2b-256 11cde471fdf81771b3b188249bbf802e6f2de748d3ac2ae9f03887eedf6adf45

See more details on using hashes here.

File details

Details for the file simpleynews-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: simpleynews-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for simpleynews-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dc1e91825898e9d1b9ec793935fb0c4bbc1529cfea8d6ddc0e85b9fe865793c9
MD5 6013f9c88c848dd0f6b3dc0967cd50c3
BLAKE2b-256 daaebc35c3b59a023f6bbe3797c5719163d2e2fbd4099455542313bd6e3f9351

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page