Twitter's new embedded timelines don't seem to allow dynamic creation of embedded timelines.
Here is the section on their site: https://dev.twitter.com/docs/embedded-timelines
In older versions of the API, it was possible to switch the username in the widget dynamically, but the new API forces you to store the full widget on their servers and access via a widget id. Any way around this?
Nope :( Unfortunately, Twitter matches up all of the Widgets (embedded timelines are widgets) with their id
s. As such, it recognizes your timeline widget's id
and displays your timeline, thus you cannot simply change the Twitter handle that it queries.
Here are your options:
For maximum flexibility, the second option is likely to be your best route. I can help you with that if you are using PHP or .NET, so let me know if you are (and which one).
This works excellent for Timeline with the new Twitter API 1.1
1) Download twitter4j-core-3.0.3.jar in http://twitter4j.org/en/ 2) Try use this code:
private static final String TWITTER_CONSUMER_KEY = "xxxxxxxxxxxxxxxxxx";
private static final String TWITTER_SECRET_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
private static final String TWITTER_ACCESS_TOKEN = "xxxxxxxxxxxxxxxxxxxxxxx";
private static final String TWITTER_ACCESS_TOKEN_SECRET = "xxxxxxxxxxxxxxxxxxxxxxxxx";
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
.setOAuthConsumerKey(TWITTER_CONSUMER_KEY)
.setOAuthConsumerSecret(TWITTER_SECRET_KEY)
.setOAuthAccessToken(TWITTER_ACCESS_TOKEN)
.setOAuthAccessTokenSecret(TWITTER_ACCESS_TOKEN_SECRET);
TwitterFactory tf = new TwitterFactory(cb.build());
Twitter twitter = tf.getInstance();
try {
Query query = new Query("MrEdPanama");
QueryResult result;
do {
result = twitter.search(query);
List<Status> tweets = result.getTweets();
for (Status tweet : tweets) {
System.out.println("@" + tweet.getUser().getScreenName() + " - " + tweet.getText());
}
} while ((query = result.nextQuery()) != null);
System.exit(0);
} catch (TwitterException te) {
te.printStackTrace();
System.out.println("Failed to search tweets: " + te.getMessage());
System.exit(-1);
}
I realize this question was asked months ago, but this can be achieved quite easily actually, by adding "data-" tags in your URL.
Check Twitter page for customization of the embedded timelines: https://dev.twitter.com/docs/embedded-timelines#customization
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With