Coder Social home page Coder Social logo

Comments (4)

FooseTV avatar FooseTV commented on July 30, 2024

I've been looking into this as I noticed the icons disappearing in the middle of the day yesterday as well. I traced back to the JSON used to populate the Twitter widgets and I think Twitter changed the HTML format specifically on the user icons. I never looked at this code in detail before but it appears that the element used on the icons no longer has an "src" attribute. Instead there are 2 "data-src" attributes pointing to different sized icons. I'm assuming this is for displaying higher resolution icons on high pixel density displays. I need to dig further but they may be using a new script to display the icon on their actual widget(s) as they still seem to be working.

Here's whats showing up in the TwitterFetch output:

img alt="" data-src-1x="https://pbs.twimg.com/profile_images/576399716302393345/o6pG9qqE_normal.jpeg" data-src-2x="https://pbs.twimg.com/profile_images/576399716302393345/o6pG9qqE_bigger.jpeg" data-scribe="element:avatar"

Which corresponds to the raw JSON:

\u003Cimg class=\"u-photo avatar\" alt=\"\"\n        data-src-1x=\"https:\/\/pbs.twimg.com\/profile_images\/576399716302393345\/o6pG9qqE_normal.jpeg\" data-src-2x=\"https:\/\/pbs.twimg.com\/profile_images\/576399716302393345\/o6pG9qqE_bigger.jpeg\"\n         data-scribe=\"element:avatar\"\u003E\n

Here's an example of what's on the Twitter widget now:

img class="u-photo avatar" alt="" data-src-1x="https://pbs.twimg.com/profile_images/576399716302393345/o6pG9qqE_normal.jpeg" data-src-2x="https://pbs.twimg.com/profile_images/576399716302393345/o6pG9qqE_bigger.jpeg" data-scribe="element:avatar" src="https://pbs.twimg.com/profile_images/576399716302393345/o6pG9qqE_normal.jpeg"

I was using a standard 1080p monitor so i believe Twitter's widget detected it as a 1x display and wrote the "src" element via a script. I'm looking now to see what script they are using so I can make a quick fix until TwitterFetch can be updated to account for this.

from twitter-post-fetcher.

todd-lockhart avatar todd-lockhart commented on July 30, 2024

Quick workaround, depending upon what version of the script you're using.

If you're using the minified script, replace -

f[b].innerHTML

with

f[b].innerHTML.replace('data-src-2x','src')

and similarly for f[b].innerText and f[b].textContent

If using the non-minified version, replace -

strip(authors[n].innerHTML)

with

strip(authors[n].innerHTML.replace('data-src-2x','src'))

and similarly for authors[n].innerText and authors[n].textContent

from twitter-post-fetcher.

jemjam avatar jemjam commented on July 30, 2024

Yeah, I found a similar solution - by swapping the data-src-1x (or 2x) value into the image source by default. It means the image loads like normal with a 1x/2x src (but also that the user never gets the other version either).

Edit - I've sent through a PR that I think fixes this. Let me know if it's helpful (or if I should change anything about it, etc). #58

from twitter-post-fetcher.

jasonmayes avatar jasonmayes commented on July 30, 2024

This is now fixed #58

from twitter-post-fetcher.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.