Last active
February 26, 2022 12:55
-
-
Save Niweera/498701d3dbbae298ba574eb2a89af529 to your computer and use it in GitHub Desktop.
TweetPik API service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from "axios"; | |
import config from "../keys"; | |
export default class TweetPikService { | |
async getScreenshot(tweetId) { | |
const response = await axios.post( | |
`https://tweetpik.com/api/images`, | |
{ | |
tweetId, | |
themeId: config.TWEETPIK_THEME_ID, | |
timezone: "Asia/Colombo", | |
}, | |
{ | |
headers: { | |
"Content-Type": "application/json", | |
authorization: config.TWEETPIK_API_KEY, | |
}, | |
} | |
); | |
console.log(`Now obtained the original screenshot`); | |
return `${response.data.url}?${new Date().getTime()}`; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment