Twitter MediaSite BBcode [Deleted]

any way to make the embedded images inside a tweet responsive?

heres what large images look like now when you embed a tweet

FIJKUmp.png


when quoted they look way off

KLqCgKx.png


heres what it should look like with width = 100 and height = auto

mc8d084.png
 
Last edited:
any way to make the embedded images inside a tweet responsive?

heres what large images look like now when you embed a tweet

FIJKUmp.png


when quoted they look way off

KLqCgKx.png


heres what it should look like with width = 100 and height = auto

mc8d084.png

It's not worth even trying, the old method this bbcode uses is pretty much obsolete as per twitter...

http://www.bbcod.es/twitter/?tweet=479323018448363520 is a standalone example using the newer api endpoints and as you can see it is already responsive (imagine ?tweet=479323018448363520 is the same as putting in [media=tweet]479323018448363520[/media]). The quoting thing is not a simple fix because the toggled height of the quote container is set before the tweet is inserted and rendered and I believe that the height of the quote container effects the rendered height

Just checking in with you.
I still haven't had the time to break this off as I have my own set of problems unrelated to this that are turning out to be a bit difficult to solve and that absorbs most of time these couple of weeks. Sorry for the delay, just try and remember that folks at twitter get paid to update this stuff, I don't get paid for stuff I build on top of that so with that said this is really not a high priority thing to me.

Would be happy to. If you have a thread that happens to have 5+ embedded tweets that (as I recall) was the point at which they'd start to regularly break, before that (or around there) it was hit or miss.

PM when and as you please, and thanks.

I will send you a pm now with a link to where the newer version of this is installed and you can play around there and see what you find , just do not post anything there that is not directly testing tweets. I have already found a few things that were fixed because of changes they made but there is also a few new things that popup all of which relate to quoted tweets, when a tweet isn't quoted it always displays correctly now though as far as I can see. Don't mind the speed, I have disabled all cache stuff for testing reasons so it goes through the full process for each tweet amongst other things.
 
This has been working fine for me for a long time.
Just over this weekend I've had a bunch of server error log entries related to it:
Code:
ErrorException: Undefined index: html - library/MediaSites/Twitter.php:14
Generated By: Unknown Account, 42 minutes ago
Stack Trace
#0 /usr/home/www/.../forums/library/MediaSites/Twitter.php(14): XenForo_Application::handlePhpError(8, 'Undefined index...', '/usr/home/www/v...', 14, Array)
#1 [internal function]: MediaSites_Twitter::buildEmbed('561918684105408...', Array, 'twitter')
#2 /usr/home/www/.../forums/library/XenForo/BbCode/Formatter/Base.php(1862): call_user_func_array(Array, Array)
#3 /usr/home/www/.../forums/library/XenForo/BbCode/Formatter/Base.php(1742): XenForo_BbCode_Formatter_Base->_getMediaSiteHtmlFromCallback('561918684105408...', Array, 'twitter')
#4 [internal function]: XenForo_BbCode_Formatter_Base->renderTagMedia(Array, Array, Object(Sedo_TinyQuattro_BbCode_Formatter_Base))
#5 /usr/home/www/.../forums/library/XenForo/BbCode/Formatter/Base.php(745): call_user_func(Array, Array, Array, Object(Sedo_TinyQuattro_BbCode_Formatter_Base))
#6 /usr/home/www/.../forums/library/XenForo/BbCode/Formatter/Base.php(652): XenForo_BbCode_Formatter_Base->renderValidTag(Array, Array, Array)
#7 /usr/home/www/.../forums/library/XenForo/BbCode/Formatter/Base.php(565): XenForo_BbCode_Formatter_Base->renderTag(Array, Array, 0)
#8 /usr/home/www/.../forums/library/XenForo/BbCode/Formatter/Base.php(546): XenForo_BbCode_Formatter_Base->renderTreeElement(Array, Array, 0)
#9 /usr/home/www/.../forums/library/XenForo/BbCode/Formatter/Base.php(526): XenForo_BbCode_Formatter_Base->renderSubTree(Array, Array)
#10 /usr/home/www/.../forums/library/XenForo/BbCode/Parser.php(505): XenForo_BbCode_Formatter_Base->renderTree(Array, Array)
#11 /usr/home/www/.../forums/library/XenForo/ViewPublic/Forum/View.php(64): XenForo_BbCode_Parser->render('I really wouldn...', Array)
#12 /usr/home/www/.../forums/library/XenForo/ViewRenderer/Abstract.php(227): XenForo_ViewPublic_Forum_View->renderRss()
#13 /usr/home/www/.../forums/library/XenForo/ViewRenderer/Rss.php(31): XenForo_ViewRenderer_Abstract->renderViewObject('XenForo_ViewPub...', 'Rss', Array, 'forum_view')
#14 /usr/home/www/.../forums/library/XenForo/FrontController.php(586): XenForo_ViewRenderer_Rss->renderView('XenForo_ViewPub...', Array, 'forum_view', NULL)
#15 /usr/home/www/.../forums/library/XenForo/FrontController.php(158): XenForo_FrontController->renderView(Object(XenForo_ControllerResponse_View), Object(XenForo_ViewRenderer_Rss), Array)
#16 /usr/home/www/.../forums/index.php(13): XenForo_FrontController->run()
#17 {main}
Request State
array(3) {
  ["url"] => string(89) "http://.../forums/forums/world-politics-current-affairs-and-news.35/index.rss"
  ["_GET"] => array(1) {
    ["/forums/forums/world-politics-current-affairs-and-news_35/index_rss"] => string(0) ""
  }
  ["_POST"] => array(0) {
  }
}
The problem seems to be that it's trying to render the Twitter embed though the request is for the forum RSS feed (with associated previews).
Any ideas?
 
Sedo_TinyQuattro_BbCode_Formatter_Base

Don't know what this is other than it is not stock xf stuff, if there is something else you changed just before this weekend you should take a look at those things. I have never seen an error come from such a simple bbcode callback (and I have not been able to replicate any type of errors, even the newest twitter integration I made with many more options than just single tweets hasn't thrown a single error after being up for months on a test site and it has way more to it than this simple callback) and the mention of outside addons makes me think something else out of this media sites reach is causing your problem itself.


'Sedo' I think refers to Cedric so maybe see what he has to say about that since if I had to guess that refers to his addon which replaces the stock xf editor, though I could be wrong as I don't use it myself.
 
'Sedo' I think refers to Cedric so maybe see what he has to say about that since if I had to guess that refers to his addon which replaces the stock xf editor, though I could be wrong as I don't use it myself.
Yes, it's his TinyQuattro editor which I have as an option.
I'll look at disabling that and see whether the problem reoccurs.
 
Disabled the TinyQuattro add on but it made no difference.

It seems that the problem is caused when a Tweet no longer exists - this is the one that was coming up in the error:
https://twitter.com/SurenaSays/status/561918684105408512/

If I try to post that into a new message I get an error, but the repeated error in the logs seems to be caused by the tweet existing when the post was made but the tweet has been deleted when the RSS feed is rendered. So a bit of an edge-case.

Removing that tweet from the first post of a thread on the thread list makes the error go away.
 
Last edited:
Hm, I will grab this version again and see what is going on here when I get a lil bit of time (keep your broken tweet link to test after and make sure the fixx works for you when I do apply it.)

On an semi unrelated note, some docs I made that test functionality of the twitter API (the parts I was using) actually don't work right now so I am wondering if internally they changed some of their methodology up.

I don't have the time to do much about it right now as this is free (and the other thing is unreleased) and twitter sure as hell doesn't pay me so if anything I am glad I never released the updated version of my twitter integration that relies completely on the API because it would have been a nightmare to be rushed to fix it (basically have to troll the API and figure out what changed that broke a whole bunch of stuff that worked literally up until the other day.)


Thanks for bringing up your issue, I probably would have never noticed my own problems which may be related to this and if I get the time I will add them to the list of stuff to do eventually.
 
Glad to be of help. I guess it's one of the more unusual cases to check for and probably just needs a tweak to catch the "no such tweet" response that Twitter is sending.

As I say, this add-on has been fine for ages, and after removing that missing tweet continues to do great service, so thanks!
 
Glad to be of help. I guess it's one of the more unusual cases to check for and probably just needs a tweak to catch the "no such tweet" response that Twitter is sending.

As I say, this add-on has been fine for ages, and after removing that missing tweet continues to do great service, so thanks!
Nah it's not unusual, it's a third party site with no external control/beacon for content (nothing direct that could be done that wouldn't require something custom to monitor something and store it internally like [tweet:state] ) and that can happen, which means something should be done by twitter or end developers (people like me) so that removal of content can fail gracefully with a little less misery.

I could do something for this with a cache mechanism of sorts I built for something else that can check old -> new on interval and if new is different than old, replace old and if new is invalid mark removed and switch the cache for this item to be flagged permanent so that it never checks to update the cache for that item on interval + access.

I could always be lazy and hard cache tweet data and rebuild the embedded tweet myself so it's all locally stored but if someone deletes a tweet it's because they want it removed, it's not my place to distribute something that circumvents that, which means if I do work around it I have to store and check cache in one request per interval of time and if removed change cached content for that tweet with a 'tweet removed' message and some kind of flag to tell the cache system to not check for updates on deleted tweets or ever request them again.


If I go do all that it is not going to get added to this release which is supposed to be small and lightweight and I would instead add it to the workhorse version of this and like I said I don't have the time to do so at the moment so it's a catch 22.



One thing I can tell you as someone who doesn't necessarily use twitter but messes around with their API is that one should register new apps instead of reusing keys and secrets even if it just for testing because things can happen and valid tokens can become invalid making requests sent using them for auth not work at all.

Moral of the story for this last little tidbit...

Register a new app for anything requiring an API request with twitter and supply each of those things their own key and secret so you don't break stuff which ended up being my issue while testing things (I forgot I had put up a standalone doc which shared key and secret with my xf twitter integration and hitting that url destroyed the stored token I used in xf in order to make a new bearer token, basically the = of going to endpoint oauth2/invalidate_token and destroying your token).
Code:
Only one bearer token may exist outstanding for an application, and repeated requests to this method will yield the same already-existent token until it has been invalidated.

https://dev.twitter.com/oauth/reference/post/oauth2/token

dfsfa.webp
Fixing this makes everything for the new version works as well even if a tweet is removed (I used your example tweet to show what it does on deleted tweet).
hgjfgjhg.webp




I do honestly thank you for pointing what you did out as it made me go back and look at things before I answered here and because of that I realized a problem which I mentioned in the above post and found the solution as noted in the previous lines.
 
Last edited:
Top Bottom