Multiple twitter feeds in embedded timeline

2019-04-11 12:30发布

I am working on a site right now where there will be multiple company profiles. Each profile needs to have a twitter feed on it, and in each feed I need to be able to include at least 2 twitter user's tweets (the company being profiled and the site's feed itself - there may also be a third).

I'm a little concerned with getting too far from what twitter provides because it seems they have a history of changing the API and everyone's feeds going down, but I don't know, maybe in this case I have to? I added a jquery tag in case a script is what's necessary here.

I embedded a timeline via: https://dev.twitter.com/docs/embedded-timelines but it seems to allow only one user in a feed at a time. The data-screen-name attribute seems to only support 1 name.

I can't use favorites and prefer not to use lists as I would need to create a list for every single profile which only includes that profile and the site's profile. There MUST be a better way to do this!

Any advice is much appreciated.

3条回答
神经病院院长
2楼-- · 2019-04-11 13:18

Log into twitter, go to settings > widgets

Click on Search

In the Search Query box, enter the following

from:USER1+OR+from:USER2

and replace USER1 and USER2 with the two accounts you want to follow

Here's an example:

<a class="twitter-timeline" href="https://twitter.com/search?q=from%3Arealdonaldtrump%2BOR%2Bfrom%3Akimkardashian" data-widget-id="702689948600676353">Tweets about from:realdonaldtrump+OR+from:kimkardashian</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
查看更多
成全新的幸福
3楼-- · 2019-04-11 13:19

IMO, what you are looking for is Public Streams. Something like below should give you tweet stream from accounts @twitter and @ev

http://stream.twitter.com/1.1/statuses/filter.json?follow=twitter,ev

查看更多
Animai°情兽
4楼-- · 2019-04-11 13:31

I found another, easier way to do this as well, using the twitter widget maker. Simply include the OR operator and Voila! two users (or more) in one feed!

https://twitter.com/settings/widgets/new/search?query=from%3Athedailyshow%20OR%20from%3Acnn

In fact, it can get quite advanced. To make a more complex feed, simply go to: https://twitter.com/search-advanced make your search (multiple users just delineated by spaces) click search, and then in the results click the gear at the top right for "embed this search" to take you to the widget maker. Easy peasy.

In the href for the link it gives: href="https://twitter.com/search?q=from%3Athedailyshow+OR+from%3Acnn it's easy enough to change the usernames or add more. I'll be using jquery to replace the values for each given page.

查看更多
登录 后发表回答