1
0
Fork 0
Ir para arquivo
Marcus Noble 8e52e8ff80 Updated readme 2021-03-21 14:26:07 +00:00
.dockerignore Added dockerignore 2020-04-01 12:18:54 +01:00
.gitignore Initial commit 2018-01-14 12:00:54 +00:00
.nvmrc Initial commit 2018-01-14 12:00:54 +00:00
Dockerfile Added Dockerfile 2020-04-01 12:16:08 +01:00
Makefile Added Makefile 2020-05-08 15:13:32 +01:00
README.md Updated readme 2021-03-21 14:26:07 +00:00
cache.js Added Redis cache support 2018-01-14 13:50:34 +00:00
index.html Updated webpage 2021-03-21 14:23:47 +00:00
index.js Updated webpage 2021-03-21 14:23:47 +00:00
logo.png Updated readme 2021-03-21 14:26:07 +00:00
package.json Added Redis cache support 2018-01-14 13:50:34 +00:00
twitter.js Added size support to default image 2018-01-14 14:16:52 +00:00

README.md

twitter-profile-pic

Get a twitter profile pic using a given handle

Available at https://twitter-profile-pic.cluster.fun/

Features

  • Multiple image size support (currently supported: normal, bigger, mini, original, 200x200, 400x400)
  • JSON support using application/json content type header
  • Returns a default profile pic for unknown users

Example: HTML

Code:

<img src="https://twitter-profile-pic.cluster.fun/marcus_noble_?size=normal" />

Result:

Example: JSON

cURL Request:

curl -X GET \
  https://twitter-profile-pic.cluster.fun/marcus_noble_ \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'postman-token: 680d968e-9b13-85c8-f7d5-9b48a333702f'

Result:

{
    "normal": "https://pbs.twimg.com/profile_images/776738772759277569/hfaM5zhA_normal.jpg",
    "bigger": "https://pbs.twimg.com/profile_images/776738772759277569/hfaM5zhA_bigger.jpg",
    "mini": "https://pbs.twimg.com/profile_images/776738772759277569/hfaM5zhA_mini.jpg",
    "original": "https://pbs.twimg.com/profile_images/776738772759277569/hfaM5zhA.jpg",
    "200x200": "https://pbs.twimg.com/profile_images/776738772759277569/hfaM5zhA_200x200.jpg",
    "400x400": "https://pbs.twimg.com/profile_images/776738772759277569/hfaM5zhA_400x400.jpg"
}

Requirements

Redis is required if caching is wanted. You will also need Twitter credentials that can be created here: https://apps.twitter.com/

Environment Variables:

TWITTER_CONSUMER_KEY=
TWITTER_CONSUMER_SECRET=
TWITTER_ACCESS_TOKEN_KEY=
TWITTER_ACCESS_TOKEN_SECRET=
REDIS_URL=