summedia


Namesummedia JSON
Version 24.2.2 PyPI version JSON
download
home_pagehttps://github.com/Sebastvin/summedia
SummarySumMedia 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.
upload_time2024-02-09 14:33:46
maintainer
docs_urlNone
authorSebastian Malon
requires_python>=3.9
license
keywords python openai text article
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
<img src="https://github.com/Sebastvin/engineer-demo/assets/34211633/a7327ebd-8489-4c8d-a58b-8936967bf639" height="300" width="300">
<br>
<img src="https://github.com/Sebastvin/engineer-demo/assets/34211633/01e65a79-69e8-4c58-bccb-ab9939ecf442">
</div>

<hr>


![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/Sebastvin/summedia/test.yml)
[![GitHub License](https://img.shields.io/github/license/Sebastvin/summedia)](https://github.com/Sebastvin/summedia)
[![GitHub issues](https://img.shields.io/github/issues/Sebastvin/summedia)](https://github.com/Sebastvin/summedia/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](#article-extraction)
2. [SumMedia for Filtering and Categorizing Articles](#summedia-for-filtering-and-categorizing-articles)
3. [SumMedia as a Personal Assistant for Reading Articles](#summedia-as-a-personal-assistant-for-reading-articles)
4. [SumMedia for Generating Post for Social Media](#summedia-for-generating-post-for-social-media)
5. [Multi-language Support](#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.

```python
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.

```python
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.

```python
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.

```python
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.

```python
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.

```python
import os
from summedia.elastic import ElasticAPIRequester

elastic_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 = elastic_prompt.elastic_prompt(content_system_prompt, content_user_prompt,  model_type="gpt-3.5-turbo-1106")
```

---

### Requirements & Costs
You'll need a <b>paid</b> 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
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Sebastvin/summedia",
    "name": "summedia",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "python openai text article",
    "author": "Sebastian Malon",
    "author_email": "sebastvin@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e4/b6/92e77ff5cf9da105619c77f6ea9a6df85720598005311f4e32da408353b3/summedia-24.2.2.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n<img src=\"https://github.com/Sebastvin/engineer-demo/assets/34211633/a7327ebd-8489-4c8d-a58b-8936967bf639\" height=\"300\" width=\"300\">\n<br>\n<img src=\"https://github.com/Sebastvin/engineer-demo/assets/34211633/01e65a79-69e8-4c58-bccb-ab9939ecf442\">\n</div>\n\n<hr>\n\n\n![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/Sebastvin/summedia/test.yml)\n[![GitHub License](https://img.shields.io/github/license/Sebastvin/summedia)](https://github.com/Sebastvin/summedia)\n[![GitHub issues](https://img.shields.io/github/issues/Sebastvin/summedia)](https://github.com/Sebastvin/summedia/issues)\n\n\n# SumMedia in a News Web package\n\nThe 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:\n\n## Table of Contents\n1. [Article Extraction](#article-extraction)\n2. [SumMedia for Filtering and Categorizing Articles](#summedia-for-filtering-and-categorizing-articles)\n3. [SumMedia as a Personal Assistant for Reading Articles](#summedia-as-a-personal-assistant-for-reading-articles)\n4. [SumMedia for Generating Post for Social Media](#summedia-for-generating-post-for-social-media)\n5. [Multi-language Support](#multi-language-support)\n\n\n---\n\n### Article Extraction\nDownload articles from a given URL and extract useful information like the text, authors, publish date, images, videos, and more.\n\n```python\nfrom summedia.fetching_data import (\n    get_text,\n    get_time_read,\n    get_images,\n    get_publishing_date,\n    get_authors,\n    get_title,\n    get_movies,\n    get_meta_description,\n    get_meta_keywords\n)\n\nURL = \"www.example.url\"\n\ntext_article = get_text(URL)\ntime_read = get_time_read(URL, words_per_minute=238)\nimg_urls = get_images(URL)\npublish_date = get_publishing_date(URL)\nauthors = get_authors(URL)\ntitle = get_title(URL)\nmovies = get_movies(URL)\nmeta_description = get_meta_description(URL)\nmeta_keywords = get_meta_keywords(URL)\n```\n---\n\n### Filtering and Categorizing Articles\nThe 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.\n\n```python\nimport os\nfrom summedia.text import Text\n\ntxt = Text(api_key=os.environ.get(\"OPENAI_API_KEY\"))\ntag_and_categorize_text = txt.tag_and_categorize_text(\"your text here\", model_type=\"gpt-3.5-turbo-1106\")\n```\n---\n\n### Personal Assistant for Reading Articles\nBrowse various news websites, fetch article headlines and brief summaries, and then deliver them in a user-friendly manner.\n\n```python\nimport os\nfrom summedia.text import Text\nfrom summedia.level import SimplificationLevel\n\ntext = Text(api_key=os.environ.get(\"OPENAI_API_KEY\"))\nsummary_article = text.summarize_text(\"www.example.url\", max_number_words=150, model_type=\"gpt-3.5-turbo-1106\")\nanalyze_sentiment = text.analyze_sentiment(\"www.example.url\", max_number_words=150, model_type=\"gpt-3.5-turbo-1106\")\nto_bullet_list = text.to_bullet_list(\"www.example.url\", model_type=\"gpt-3.5-turbo-1106\")\nadjust_text_complexity = text.adjust_text_complexity(\"www.example.url\", level = SimplificationLevel.STUDENT, model_type=\"gpt-3.5-turbo-1106\")\n```\n---\n\n### Generating Post for Social Media\nAutomate posts to Twitter/X and facebook by just specifying the url for article.\n\n```python\nimport os\nfrom summedia.social_media import SocialMedia\n\nsocial_media = SocialMedia(api_key=os.environ.get(\"OPENAI_API_KEY\"))\n\npost_to_facebook = social_media.post_to_facebook(\n    \"your text here\", model_type=\"gpt-3.5-turbo-1106\"\n)\n\ncondense_text_to_tweet = social_media.condense_text_to_tweet(\n    \"your text here\", model_type=\"gpt-3.5-turbo-1106\"\n)\n```\n---\n\n### Multi-language Support\nHandling articles in different languages, making it versatile for international applications. You can also use it as an article translator.\n\n```python\nimport os\nfrom summedia.text import Text\n\ntxt = Text(api_key=os.environ.get(\"OPENAI_API_KEY\"))\ntranslate_text = txt.translate_text(\"your text here\", model_type=\"gpt-3.5-turbo-1106\", language_to_translate=\"en\")\n```\n\n---\n### Create your own prompt\nCreate a prompt tailored to your needs.\n\n```python\nimport os\nfrom summedia.elastic import ElasticAPIRequester\n\nelastic_prompt = ElasticAPIRequester(api_key=os.environ.get(\"OPENAI_API_KEY\"))\ncontent_system_prompt = \"YOUR SYSTEM PROMPT HERE\"\ncontent_user_prompt = \"YOUR USER PROMPT HERE\"\nelastic_prompt_result = elastic_prompt.elastic_prompt(content_system_prompt, content_user_prompt,  model_type=\"gpt-3.5-turbo-1106\")\n```\n\n---\n\n### Requirements & Costs\nYou'll need a <b>paid</b> OpenAI account and an API key.\n\nCheck out more here:\nhttps://openai.com/pricing\n\n### Installation\n```\npip install summedia\n```\n\n\n#### How to run tests\n```\npytest --cov=summedia\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "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.",
    "version": "24.2.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/Sebastvin/summedia/issues",
        "Homepage": "https://github.com/Sebastvin/summedia"
    },
    "split_keywords": [
        "python",
        "openai",
        "text",
        "article"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5f5270bfd5ba637d226408705484bd7b8c1f6a85e8273acaf2a1e784d4dc67e7",
                "md5": "6de8e3cd3fe10e2413f77260e2dd8080",
                "sha256": "ca97ff19aae81222c93f6687adc3ee56fb1b5bce1617f67f4159b902ce04383a"
            },
            "downloads": -1,
            "filename": "summedia-24.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6de8e3cd3fe10e2413f77260e2dd8080",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 15862,
            "upload_time": "2024-02-09T14:33:45",
            "upload_time_iso_8601": "2024-02-09T14:33:45.277277Z",
            "url": "https://files.pythonhosted.org/packages/5f/52/70bfd5ba637d226408705484bd7b8c1f6a85e8273acaf2a1e784d4dc67e7/summedia-24.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e4b692e77ff5cf9da105619c77f6ea9a6df85720598005311f4e32da408353b3",
                "md5": "4c663963ea7b26720ee92be48835d3da",
                "sha256": "8cbfebe29233989beed3c83983fad628700e8d303d6d8f192d7c3b9fcf8d5ff7"
            },
            "downloads": -1,
            "filename": "summedia-24.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "4c663963ea7b26720ee92be48835d3da",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 14659,
            "upload_time": "2024-02-09T14:33:46",
            "upload_time_iso_8601": "2024-02-09T14:33:46.745865Z",
            "url": "https://files.pythonhosted.org/packages/e4/b6/92e77ff5cf9da105619c77f6ea9a6df85720598005311f4e32da408353b3/summedia-24.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-09 14:33:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Sebastvin",
    "github_project": "summedia",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "summedia"
}
        
Elapsed time: 0.18605s