New Pornstar Interviews - [more]
Introducing Dallas Rea

"I’m very submissive so I love being bossed around and told what to do."
All Forums > Tech Talk > Tech Talk Forum Page 3 > New Embedded Tweet functionality
AuthorPost
Drew Black
broken crankshaft


8011 Posts
9/99
Posted - Jan 1 2021 : 9:21AM
I recently rewrote the methods the forum uses to display embedded Tweets. In the past all of the embeds on forum page were rendered upon page load. This made topics with many Tweets appear very slowly for users. The new method lazy-loads embedded Tweets. It only fetches them if they are on-screen or close to being on-screen as you scroll through a topic. There's an animated 'Tweet loading' spinner image as a placeholder to let you know that a Tweet is being fetched.

Please let me know if you encounter any problems with this new code. It should work in all modern browsers. It won't work in Internet Explorer. (If you're using IE to browse the internet these days you should have your head examined.)

Drew Black
broken crankshaft

8011 Posts
9/99
Posted - Jan 2 2021 : 10:08AM
If you happen to see a tweet that never loads, the spinner just keeps spinning, it's likely because the account associated with the tweet has been suspended. We only refresh the status availability of tweets once every 30 days.
Lenny Voyeur
Senior Member

It's the ass, stupid!
8504 Posts
2/07
Posted - Jan 2 2021 : 1:40PM
^thank you for working on such improvements.

Acutally I never understood why the tweets posted in a thread seem to "disappear" after a while. Did I get it right that it just takes a while to reload?

Drew Black
broken crankshaft

8011 Posts
9/99
Posted - Jan 2 2021 : 2:32PM
The "disappearing" could have been just waiting for it to load. Some forum pages might have 25+ tweets embedded in posts. With the old scheme they would all need to load (slowly) before the page became responsive for users. It was very inefficient. The new scheme only loads Tweets that are visible on-screen or close to being displayed if you are scrolling. It's not perfect and sometimes has delays. Twitter also doesn't provide any kind of error reporting with this method to tell us a Tweet is no longer available. That's why sometimes the spinner will keep on spinning.

Twitter doesn't want sites hammering their servers loading data over and over. They want sites to store some of the Tweet info locally. They provide a variable "time to live" (TTL) value for this Tweet data. We kinda ignore the TTL and only refresh Tweets once every 30 days. Tweets go away for lots of reasons: the Twitter user deletes a Tweet, their Twitter account is banned/suspended, etc. Lots of adult entertainment Twitter accounts get banned by Twitter for violating their terms of service. That's the primary reason for many of the Tweets here in the forum going to some version of "unavailable".

Lenny Voyeur
Senior Member

It's the ass, stupid!
8504 Posts
2/07
Posted - Jan 3 2021 : 8:26AM
Got it now. Thank you for the details!
 
morbidthoughts All-Star Supporter
All-Star Member

Big cats scare me but...
3627 Posts
1/03
Posted - Jan 3 2021 : 6:02PM
The tweets show constantly loading on the android version of Firefox but loads up fine on Android Chrome.
Drew Black
broken crankshaft

8011 Posts
9/99
Posted - Jan 4 2021 : 4:13AM
The lazy loading feature requires IntersectionObserver support in the browser. That was added in Firefox for Android v 83 released on November 16th 2020. Do you know if you're running that version or newer?

Edited to add: I just downloaded and installed Firefox from the Google Play Store and it appears to be properly lazy-loading tweets.


Edited by - Drew Black on 1/4/2021 4:19:17 AM

morbidthoughts All-Star Supporter
All-Star Member

Big cats scare me but...
3627 Posts
1/03
Posted - Jan 4 2021 : 3:38PM
I'm using 84.1.2 on stock Android 11

Edited by - morbidthoughts on 1/4/2021 3:38:34 PM

Drew Black
broken crankshaft

8011 Posts
9/99
Posted - Jan 5 2021 : 4:51AM
I'm using the same version on stock Android/Pixel3a.


I'll do a little tinkering. I'm not logged into twitter for the web on my phone which makes the Tweets render as though I'm an anonymous Twitter user without an account. (I don't even have the Twitter app on my phone.) I'm curious if there's a bug in the Twitter JS libraries that render Tweets with their API.

Jman5245 All-Star Supporter
All-Star Member

flickr.com/jman5245
5764 Posts
5/09
Posted - Jan 5 2021 : 9:29AM
None of the Tweets will load for me. They just buffer endlessly. I'm using Firefox 84.0.1 (64-bit) on a PC with Windows 10.

I've disabled all ad/tracking blockers and whitelisted the ADT website, but they still won't load.

Drew Black
broken crankshaft

8011 Posts
9/99
Posted - Jan 5 2021 : 11:44AM
Can you click the purple shield next to the URL in Firefox and see if maybe it is blocking the Tweet embeds under it's Enhanced Tracking Protection?


firefox-blocking.gif

morbidthoughts All-Star Supporter
All-Star Member

Big cats scare me but...
3627 Posts
1/03
Posted - Jan 5 2021 : 2:07PM
It still didn't work when I turned off the tracking protection on Android Firefox.


Desktop Firefox works fine with or without the shield.

morbidthoughts All-Star Supporter
All-Star Member

Big cats scare me but...
3627 Posts
1/03
Posted - Jan 5 2021 : 2:16PM
I figured it out. It was the Enhanced Tracking Protection but there are different levels. For some reason, my default Protection was on Strict for Android and was on Standard for Desktop.

I have attached the settings for Desktop for you to look for under Options under Privacy & Security:

firefox.jpg

Drew Black
broken crankshaft

8011 Posts
9/99
Posted - Jan 5 2021 : 2:47PM
Thanks for the help diagnosing this. I'll see if there's anything I can do on the dev side of things to make it work with the Strict settings.
Jman5245 All-Star Supporter
All-Star Member

flickr.com/jman5245
5764 Posts
5/09
Posted - Jan 5 2021 : 4:48PM
That was the problem. Tweets load fine now. Not sure how I missed it. Thanks Drew.
 
Drew Black
broken crankshaft

8011 Posts
9/99
Posted - Jan 6 2021 : 1:44PM
I've updated the way the Tweet loading spinner works today. It's now a clickable element. So you can click it and see why the Tweet didn't load. Likely due to suspended accounts or privacy restrictions.

Drew Black
broken crankshaft

8011 Posts
9/99
Posted - Jan 7 2021 : 8:17AM
I've updated the code that interfaces with Twitter's API to check the status responses for private tweets and suspended accounts. We should start to see them get cleaned up soon.
morbidthoughts All-Star Supporter
All-Star Member

Big cats scare me but...
3627 Posts
1/03
Posted - Dec 11 2021 : 2:37PM
I'm having 5-10 second delays loading up tweets now. I fiddled around with my firefox settings like the enhanced protection but it's not making a difference. I checked Chrome, and it's not happening there.
killbillvol69 All-Star Supporter
All-Star Member

^Lucy Pinder
18633 Posts
4/08
Posted - Dec 12 2021 : 12:21AM
I'm experiencing the same thing (also suing firefox). I thought initially it was due to the amazon web services problems from a couple days ago, but it's still happening.
Drew Black
broken crankshaft

8011 Posts
9/99
Posted - Dec 12 2021 : 6:02AM
I'll check it out.
Drew Black
broken crankshaft

8011 Posts
9/99
Posted - Dec 12 2021 : 6:17AM
It's working normally for me in FF 95. I have the Enhanced Tracking Protection set as "Standard". If you're not using standard could you send me a PM with your settings so I can try to replicate the issue and study it? I tinkered with some of the other Enhanced Tracking Protection options and most of them seem to block Twitter's widgets file completely which will cause Tweets to not render at all. I'm not able to figure out which setting makes them render slowly.

killbillvol69 All-Star Supporter
All-Star Member

^Lucy Pinder
18633 Posts
4/08
Posted - Dec 12 2021 : 11:12AM
I have firefox 95.0 (just updated yesterday) and I have Enhanced Tracking Protections set to Standard as well.

The issue is still happening today, so it was happening both before and after the new FF update.

morbidthoughts All-Star Supporter
All-Star Member

Big cats scare me but...
3627 Posts
1/03
Posted - Dec 13 2021 : 5:31PM
I have mine on standard too. I suspect it is one of the non-customisable part of the extended protection settings. Either that or turning it off on the ADT domain doesn't impact how it sees the twitter api.
Drew Black
broken crankshaft

8011 Posts
9/99
Posted - Dec 14 2021 : 4:54AM
What's strange though is that I'm seeing normal Tweet rendering speed with FF95, possibly even faster than in Chrome.

I'll check it from a different ISP soon. I'm on Starlink at the home office now.

Drew Black
broken crankshaft

8011 Posts
9/99
Posted - Dec 14 2021 : 5:16AM
I'm seeing the slow loading of the Tweets in FF now in the Gia OhMy topic. I switched to my tethered Verizon connection and they are loading very slowly. Not sure why. If I switch back to Starlink things load quickly.

Watching the waterfall in the network tab using a developer tools window shows the delay appears to be happening within Twitter's code that inserts and inline Iframe and renders the tweet within the forum page.

I use the Intersection Observer API to lazy-load the Tweets as a user scrolls down the page. I'm going to see if maybe the new version of FF has a slightly different IO API implementation and is slow to detect the tweet placeholder moving into the visible area before firing the event that loads the Tweet content.


edited to add:

I've watched the page loading more closely. The Twitter script that injects the embedded Tweet iframe's CSS & html is loading very quickly. Something in FF is preventing the resources in that iframe from being fetched and rendered quickly. I'll take a look at it a bit more but at the moment I don't think there's much I can do to speed it up because the scripts that load the Tweet content come from Twitter's servers.


Edited by - Drew Black on 12/14/2021 7:38:32 AM




Jump To: