Skip to main content


GitHub Workflow Status (with event) GitHub License GitHub issues

SumMedia in a News Web package

The SumMedia 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

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

from summedia.fetching_data import (
    get_text,
    get_time_read,
    get_images,
    get_publishing_date,
    get_authors,
    get_title,
    get_movies,
    get_meta_description,
    get_meta_keywords
)

URL = "www.example.url"

text_article = get_text(URL)
time_read = get_time_read(URL, words_per_minute=238)
img_urls = get_images(URL)
publish_date = get_publishing_date(URL)
authors = get_authors(URL)
title = get_title(URL)
movies = get_movies(URL)
meta_description = get_meta_description(URL)
meta_keywords = get_meta_keywords(URL)

Filtering and Categorizing Articles

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

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")

Personal Assistant for Reading Articles

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

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", max_number_words=150, 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")

Generating Post for Social Media

Automate posts to Twitter/X and facebook by just specifying the url for article.

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

Handling articles in different languages, making it versatile for international applications. You can also use it as an article translator.

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")

Create your own prompt

Create a prompt tailored to your needs.

import os
from summedia.elastic import ElasticAPIRequester

your_prompt = ElasticAPIRequester(api_key=os.environ.get("OPENAI_API_KEY"))
content_system_prompt = "YOUR SYSTEM PROMPT HERE"
content_user_prompt = "YOUR USER PROMPT HERE"
elastic_prompt_result = your_prompt.elastic_prompt(content_system_prompt, content_user_prompt,  model_type="gpt-3.5-turbo-1106")

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

Metadata

Release files for summedia 24.2.3

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

Source distribution (sdist)

Source distribution for summedia 24.2.3
File Size Uploaded Provenance Actions
summedia-24.2.3.tar.gz 14.7 kB Without provenance Details for summedia-24.2.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for summedia 24.2.3
File Interpreter ABI Platform Actions
summedia-24.2.3-py3-none-any.whl Python 3 none any Details for summedia-24.2.3-py3-none-any.whl

Total release size: 30.5 kB

Release files / summedia-24.2.3.tar.gz

Download URL summedia-24.2.3.tar.gz
Size 14.7 kB
Tags Source
SHA-256 checksum
How to use checksums
800d20835bae8e1c7d007e52571bb862f509b52dac416c648100f0eabd76bca8
BLAKE2b-256 checksum
How to use checksums
341f883bd480a770ce075637b19fab50671bcebee8c8be133512dea04f47c38f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Release files / summedia-24.2.3-py3-none-any.whl

Download URL summedia-24.2.3-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b07f1ae72a912a4139f3dca53e707d8563f53a26f736734f3521a35595501462
BLAKE2b-256 checksum
How to use checksums
b1df7d33cbef690dc62abae6ecb2cd4d3f7a914a5bec1076e0f6d4d5850253af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Security for summedia 24.2.3

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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