Get started with twitter-fetcher CDN
MIT licensed
Python library: Twitter Fetcher - retrieves tweets, user info via Twitter API.
Tags:- OAUTH
- JavaScript
- tweets
- api
- widget
Stable version
Copied!
How to start using twitter-fetcher CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with twitter-fetcher CDN - cdnhub.io</title>
<script src="https://cdn.cdnhub.io/twitter-fetcher/18.0.4/js/twitterFetcher_min.js"></script>
</head>
<body>
<button id="fetchTweets">Fetch Tweets</button>
<div id="tweets"></div>
<script>
const fetchTweetsButton = document.getElementById('fetchTweets');
const tweetsContainer = document.getElementById('tweets');
fetchTweetsButton.addEventListener('click', async () => {
try {
const response = await twitterFetcher.fetch('reactjs');
const tweets = response.data.statuses;
tweetsContainer.innerHTML = '';
tweets.forEach((tweet) => {
tweetsContainer.innerHTML += `<p>${tweet.text}</p>`;
});
} catch (error) {
console.error('Error fetching tweets:', error);
}
});
</script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!