Skip to main content

SumMedia library is a powerful Python package used for extracting and parsing newspaper articles. It simplifies the process of web scraping, article downloading and working with openai API. The plugin enables various functionalities related to news content personalization and categorization.

Project description



GitHub Workflow Status (with event) GitHub License GitHub issues

Using SumMedia in a News Web Application

The SumMedia library is a powerful Python tool used for extracting and parsing newspaper articles. It simplifies the process of web scraping, article downloading and working with openai API. The plugin enables various functionalities related to news content personalization and categorization. Here's an overview of its key features and functionalities:

Table of Contents

  1. Article Extraction
  2. SumMedia for Filtering and Categorizing Articles
  3. SumMedia as a Personal Assistant for Reading Articles
  4. SumMedia for Generating Post for Social Media
  5. Multi-language Support

Article Extraction

SumMedia can download articles from a given URL and extract useful information like the text, authors, publish date, images, videos, and more.

Example:

from summedia.fetching_data import (
    article_time_read,
    get_images_from_html,
    get_text_from_article,
)

text_article = get_text_from_article("www.example.url")
time_read = article_time_read(text_article, words_per_minute=238)
img_urls = get_images_from_html("www.example.url")

SumMedia for Filtering and Categorizing Articles

The work can involve using ChatGPT to analyze and filter news, removing spam, false information, or inappropriate content. You can also develop an algorithm for categorizing articles based on topic, location, date, and other factors.

Example:

import os
from summedia.text import Text

txt = Text(api_key=os.environ.get("OPENAI_API_KEY"))
tag_and_categorize_text = txt.tag_and_categorize_text("your text here", model_type="gpt-3.5-turbo-1106")

SumMedia as a Personal Assistant for Reading Articles

SumMedia can browse various news websites, fetch article headlines and brief summaries, and then deliver them in a user-friendly manner.

Example:

import os
from summedia.text import Text
from summedia.level import SimplificationLevel

text = Text(api_key=os.environ.get("OPENAI_API_KEY"))
summary_article = text.summarize_text("www.example.url", max_number_words=150, model_type="gpt-3.5-turbo-1106")
analyze_sentiment = text.analyze_sentiment("www.example.url", model_type="gpt-3.5-turbo-1106")
to_bullet_list = text.to_bullet_list("www.example.url", model_type="gpt-3.5-turbo-1106")
adjust_text_complexity = text.adjust_text_complexity("www.example.url", level = SimplificationLevel.STUDENT, model_type="gpt-3.5-turbo-1106")

SumMedia for Generating Post for Social Media

With SumMedia you are able to automate posts to Twitter/X and facebook by just specifying the url for article.

Example:

import os
from summedia.social_media import SocialMedia

social_media = SocialMedia(api_key=os.environ.get("OPENAI_API_KEY"))

post_to_facebook = social_media.post_to_facebook(
    "your text here", model_type="gpt-3.5-turbo-1106"
)

condense_text_to_tweet = social_media.condense_text_to_tweet(
    "your text here", model_type="gpt-3.5-turbo-1106"
)

Multi-language Support

SumMedia is capable of handling articles in different languages, making it versatile for international applications.

You can also use it as an article translator.

Example:

import os
from summedia.text import Text

txt = Text(api_key=os.environ.get("OPENAI_API_KEY"))
translate_text = txt.translate_text("your text here", model_type="gpt-3.5-turbo-1106", language_to_translate="en")

Requirements & Costs

You'll need a paid OpenAI account and an API key.

Check out more here: https://openai.com/pricing

Installation

pip install summedia

How to run tests

pytest --cov=summedia

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

summedia-24.1.3.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

summedia-24.1.3-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file summedia-24.1.3.tar.gz.

File metadata

  • Download URL: summedia-24.1.3.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for summedia-24.1.3.tar.gz
Algorithm Hash digest
SHA256 8290641dee94f0679bc536b8d67300189e1307f2a4f9f2916e4a3fdb424c7ec9
MD5 68814c76915e9ba7b15d2bb7cb2167c5
BLAKE2b-256 0163b7054ca64f276c9444bd25f428055431f94dd75174ff8e40be17d08799f6

See more details on using hashes here.

File details

Details for the file summedia-24.1.3-py3-none-any.whl.

File metadata

  • Download URL: summedia-24.1.3-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for summedia-24.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1ced6251d7a79feb0ea1cbb83cfd2245ff81ec6a634a7a89a17ee6346e6ea70b
MD5 278a95e0c0d18e1f7eaec7010781ea63
BLAKE2b-256 3deea8f3a8635f09c6b4a42923831549e9f091b5cfd069e2ab27ddfc78669f54

See more details on using hashes here.

Supported by

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