<div align="center">
<img alt="Logo" src="https://github.com/arnavmarda/twitter-news-bot/blob/main/docs/logo.png" width=200 />
</div>
<div align="center">
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![PyPI version](https://badge.fury.io/py/twitternewsbot.svg)](https://badge.fury.io/py/twitternewsbot)
[![forthebadge made-with-python](http://ForTheBadge.com/images/badges/made-with-python.svg)](https://www.python.org/)
</div>
# twitter-news-bot
A python API allowing users to:
1. Scrape news articles from Google News.
2. Extract the articles from the news sources.
3. Create and post tweets(or now Xs) using `tweepy`.
4. Leverage PaLM to generate summaries from articles as tweets and to generate tweets.
5. Pipeline and automate the scraping and tweeting procedure using a `cron` job.
# Quick Start
For complete documentation and examples, please refer to the [documentation](https://arnavmarda.github.io/twitter-news-bot/).
## Installation
```bash
pip install twitternewsbot
```
## Requirements - before using the API
For more information on how to generate the following keys and tokens, please refer to the [documentation](https://arnavmarda.github.io/twitter-news-bot/).
1. To use the `tweepy` API to post tweets, you must have a Twitter developer account and create an app. You can create an app [here](https://developer.twitter.com/en/apps). Don't worry, Twitter gives you 1 free app. Once you have created an app, you will need to generate the following keys and tokens:
- Consumer API key
- Consumer API secret key
- Access token
- Access token secret
2. To use PaLM to generate tweets and completely automate the process, you will need to generate a PaLM API. To get this, you will need to sign up for the waitlist [here](https://makersuite.google.com/waitlist). You can then generate the API key.
These keys must be stored in a `.env` file in the root directory of your project. The `.env` file should look like this:
```bash
API_KEY="your-key-here"
API_SECRET_KEY="your-key-here"
ACCESS_TOKEN="your-key-here"
ACCESS_TOKEN_SECRET="your-key-here"
GOOGLE_API_KEY="your-key-here"
```
## Usage
The API is very simple to use. Here is a quick example:
```python
from twitter_news_bot.tweeter import Tweeter
from twitter_news_bot.newsfinder import NewsFinder
from twitter_news_bot.twitternewsbot import TwitterNewsBot
# Create a NewsFinder and Tweeter Object
nf = NewsFinder()
t = Tweeter()
# Create a TwitterNewsBot object
tnb = TwitterNewsBot(nf, t, topic="AI")
# Run the TwitterNewsBOt to scrape articles, extract them, summarize them and post them as tweets
tnb.run()
```
# Future Updates
- Add support for other summarization models such as OpenAI.
- Add region based searching for news articles on Google News.
Raw data
{
"_id": null,
"home_page": "https://github.com/arnavmarda/twitter-news-bot/",
"name": "twitternewsbot",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "AI,Twitter,News,Automation,Google News,Scraping,Requests,Tweepy,Articles",
"author": "Arnav Marda",
"author_email": "arnavmarda@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/04/7b/f0e0a7669ff4a39e27fb327fbdb5798f69a410a95196a077627635dfd5bf/twitternewsbot-2.0.3.tar.gz",
"platform": null,
"description": "\n<div align=\"center\">\n<img alt=\"Logo\" src=\"https://github.com/arnavmarda/twitter-news-bot/blob/main/docs/logo.png\" width=200 />\n</div>\n\n<div align=\"center\">\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![PyPI version](https://badge.fury.io/py/twitternewsbot.svg)](https://badge.fury.io/py/twitternewsbot)\n\n[![forthebadge made-with-python](http://ForTheBadge.com/images/badges/made-with-python.svg)](https://www.python.org/)\n\n</div>\n\n# twitter-news-bot\n\nA python API allowing users to:\n\n1. Scrape news articles from Google News.\n2. Extract the articles from the news sources.\n3. Create and post tweets(or now Xs) using `tweepy`.\n4. Leverage PaLM to generate summaries from articles as tweets and to generate tweets.\n5. Pipeline and automate the scraping and tweeting procedure using a `cron` job.\n\n# Quick Start\nFor complete documentation and examples, please refer to the [documentation](https://arnavmarda.github.io/twitter-news-bot/).\n\n## Installation\n```bash\npip install twitternewsbot\n```\n\n## Requirements - before using the API\nFor more information on how to generate the following keys and tokens, please refer to the [documentation](https://arnavmarda.github.io/twitter-news-bot/).\n\n1. To use the `tweepy` API to post tweets, you must have a Twitter developer account and create an app. You can create an app [here](https://developer.twitter.com/en/apps). Don't worry, Twitter gives you 1 free app. Once you have created an app, you will need to generate the following keys and tokens:\n - Consumer API key\n - Consumer API secret key\n - Access token\n - Access token secret\n\n2. To use PaLM to generate tweets and completely automate the process, you will need to generate a PaLM API. To get this, you will need to sign up for the waitlist [here](https://makersuite.google.com/waitlist). You can then generate the API key.\n\nThese keys must be stored in a `.env` file in the root directory of your project. The `.env` file should look like this:\n```bash\nAPI_KEY=\"your-key-here\"\nAPI_SECRET_KEY=\"your-key-here\"\nACCESS_TOKEN=\"your-key-here\"\nACCESS_TOKEN_SECRET=\"your-key-here\"\nGOOGLE_API_KEY=\"your-key-here\"\n```\n\n## Usage\nThe API is very simple to use. Here is a quick example:\n```python\nfrom twitter_news_bot.tweeter import Tweeter\nfrom twitter_news_bot.newsfinder import NewsFinder\nfrom twitter_news_bot.twitternewsbot import TwitterNewsBot\n\n# Create a NewsFinder and Tweeter Object\nnf = NewsFinder()\nt = Tweeter()\n\n# Create a TwitterNewsBot object\ntnb = TwitterNewsBot(nf, t, topic=\"AI\")\n\n# Run the TwitterNewsBOt to scrape articles, extract them, summarize them and post them as tweets\ntnb.run()\n```\n\n# Future Updates\n- Add support for other summarization models such as OpenAI.\n- Add region based searching for news articles on Google News.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python API allowing you to automize a personalized news delivery system.",
"version": "2.0.3",
"project_urls": {
"Download": "https://github.com/arnavmarda/twitter-news-bot/archive/refs/tags/v2.0.3.tar.gz",
"Homepage": "https://github.com/arnavmarda/twitter-news-bot/"
},
"split_keywords": [
"ai",
"twitter",
"news",
"automation",
"google news",
"scraping",
"requests",
"tweepy",
"articles"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "047bf0e0a7669ff4a39e27fb327fbdb5798f69a410a95196a077627635dfd5bf",
"md5": "af62bcdeb0439b3bbd8afa834ad69abf",
"sha256": "d43754d1dafc1a8cc2a237ce4dc29088a9cbfb0259d1bc387297c0015acc9e15"
},
"downloads": -1,
"filename": "twitternewsbot-2.0.3.tar.gz",
"has_sig": false,
"md5_digest": "af62bcdeb0439b3bbd8afa834ad69abf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13742,
"upload_time": "2023-07-29T11:20:07",
"upload_time_iso_8601": "2023-07-29T11:20:07.542772Z",
"url": "https://files.pythonhosted.org/packages/04/7b/f0e0a7669ff4a39e27fb327fbdb5798f69a410a95196a077627635dfd5bf/twitternewsbot-2.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-29 11:20:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "arnavmarda",
"github_project": "twitter-news-bot",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "twitternewsbot"
}