erwanvivien / twitter_avatar

A simple python script to retrieve someone avatar's url from their twitter name.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Twitter Avatar

A simple python script to retrieve someone avatar's url from their twitter name.

Use case

  • If you want to create fake twitter embed for discord (using the parameter discord=1)
  • If you want to download someone's image rapidly

How to use

You just need to create a json file named profile and paste the value you get from your application. Get your twitter Bearer Token

A default profile would be:

{
  "api_key": "XXXXXXXXXXXXXXXXXXXXXXXXX",
  "api_secret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "token_key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "token_secret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "bearer_token": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}

but you only need the field bearer_token

Examples

python main.py elonmusk # Will display the URL for elon musk's profile image
python main.py VivienErwan discord=1 # Will print a _ready-to-use_ discord embed using the twitter embed setup

Output1:

elonmusk:
https://pbs.twimg.com/profile_images/1364491704817098753/V22-Luf7.jpg

Output2

VivienErwan:
{
  "embed": {
    "description": "CHANGE THIS MESSAGE",
    "image": {
      "url": "CHANGE THIS URL IF YOU WANT TO HAVE AN EMBED IMAGE, OTHERWISE, REMOVE THE IMAGE FIELD"
    },
    "color": 1942002,
    "footer": {
      "icon_url": "https://abs.twimg.com/icons/apple-touch-icon-192x192.png",
      "text": "Twitter"
    },
    "author": {
      "name": "Erwan VIVIEN (@VivienErwan)",
      "icon_url": "https://pbs.twimg.com/profile_images/1358770497882886146/d8NVlGIE.png",
      "url": "https://twitter.com/VivienErwan"
    },
    "fields": [
      {
          "name": "Retweets",
          "value": "500",
          "inline": true
      },
      {
          "name": "Likes",
          "value": "500",
          "inline": true
      }
    ]
  }
}

Using an Embed Visualizer we can get this output:

image

as you can see you need need to update the url or remove the "image" field in the embed to have something viable

About

A simple python script to retrieve someone avatar's url from their twitter name.


Languages

Language:Python 100.0%