Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes#691 twitter-bot-py #725

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions Python/Twitter-Bot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Twitter Bot

### Third Party Libraries Required :
1. requests [To fetch the Url content ]
2. tweepy [Library used for web scraping]

### How to install above Library

```
pip install tweepy

```

### Fetches the following data for every API call :
- Title of anime
- Name of character
- Quote

### How to use it :
1. Download or clone the repository
2. Install Required Libraries
3. Make developer account on twitter and obtain access token and secret keys
4. Enter access tokens and secret keys in the code as specified
5. Run twitter-bot.py




![built with love](https://forthebadge.com/images/badges/built-with-love.svg)

Check out my Github profile [okarin1511!](https://github.com/okarin1511)
63 changes: 63 additions & 0 deletions Python/Twitter-Bot/twitter-bot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
from re import search
import tweepy
import time
from tweepy.api import API
import requests
import json

from tweepy.models import Status

auth = tweepy.OAuthHandler('*****enter API key here*****','*****enter secret API key*****')

auth.set_access_token('*****enter access token*****','*****enter secret access token*****')

api = tweepy.API(auth, wait_on_rate_limit = True, wait_on_rate_limit_notify = True)

user = api.me()

nrTweets = 1

search = 'Basketball', 'good'
nrTweets = 5

# Crawl tweets and like tweets that have specific keywords in them
for tweet in tweepy.Cursor(api.search, search).items(nrTweets):
try:
print('Tweet Liked')
tweet.favorite()
time.sleep(10)
except tweepy.TweepError as e:
print (e.reason)
except StopIteration:
break

# calling an api and tweeting the response
def getQuote():
url = "https://animechan.vercel.app/api/random"

response = requests.get(url)

data = response.json()
anime = data['anime']
character = data['character']
quote = data['quote']

tweet ="Anime quote #" + str(a) + "\n\n'" + quote + "'" + '\n\n-' + character + ',\n ' + anime + '\n#Anime'

return tweet

a = 14

for i in range(1):

a += 1
hello = getQuote()

api.update_status(hello)
print("Tweeted")
time.sleep(30)





49 changes: 43 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,29 @@ git clone https://github.com/<your-github-username>/Hacking-Scripts
cd Hacking-Scripts
```

**4.** Make changes in source code.
**4.** Add a reference(remote) to the original repository.
```
git remote add upstream https://github.com/Tejas1510/Hacking-Scripts.git
```

**5.** Check the remotes for this repository.
```
git remote -v
```

**6.** Always take a pull from the upstream repository to your main branch to keep it at par with the main project(updated repository).
```
git pull upstream main
```

**5.** Stage your changes and commit
**7.** Create a new branch.
```
git checkout -b <your_branch_name>
```

**8.** Make changes in source code.

**9.** Stage your changes and commit

```bash
#Add changes to Index
Expand All @@ -91,15 +111,15 @@ git add .
git commit -m "<your_commit_message>"
```

**6.** Push your local commits to the remote repo.
**10.** Push your local commits to the remote repo.

```bash
git push
git push origin <your_branch_name>
```

**7.** Create a [PR](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request) !
**11.** Create a [PR](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request) !

**8.** **Congratulations!** Sit and relax, you've made your contribution to [Hacking-Scripts](https://github.com/Tejas1510/Hacking-Scripts) project.
**12.** **Congratulations!** Sit and relax, you've made your contribution to [Hacking-Scripts](https://github.com/Tejas1510/Hacking-Scripts) project.


## 📢 Open Source Program
Expand Down Expand Up @@ -180,3 +200,20 @@ For major changes, you are welcomed to open an issue and discuss what you would
</p>

Check out my Github profile [Tejas1510!](https://github.com/Tejas1510)
# Python Script to find the details of IP input
### Introduction
This script is made using Python 3. It takes the input from the user, an IP address (ipv4 and ipv6) and returns the details about the IP, like country, city, location etc

### Third Party Library Required:
requests

### How to install the above library:
pip install requests

### How to use it.
* Download and install the latest version of [Python](https://www.python.org).
* Download and save the script.
* Navigate to where you have saved it and open a terminal there.
* Run `python script.py` in your terminal or `python3 script.py` if you have Python 2 installed as well.
* Enter the Ip you want the details of, or press enter to check your IP details