Twitter Media Downloader

Save Video/Photo by One-Click.

< Feedback on Twitter Media Downloader

Review: Good - script works

§
Posted: 30/10/2022
Edited: 30/10/2022

Works but the console gets this error:
Uncaught TypeError: Cannot read properties of null (reading 'href')
at Object.inject (userscript.html?name=Twitter%2520Media%2520Downloader.user.js&id=743f41db-2f4a-4c73-8154-de5fd5de41fb:89:69)
at userscript.html?name=Twitter%2520Media%2520Downloader.user.js&id=743f41db-2f4a-4c73-8154-de5fd5de41fb:377:51
at NodeList.forEach ()
at userscript.html?name=Twitter%2520Media%2520Downloader.user.js&id=743f41db-2f4a-4c73-8154-de5fd5de41fb:375:59
at Array.forEach ()
at MutationObserver.observe.childList (userscript.html?name=Twitter%2520Media%2520Downloader.user.js&id=743f41db-2f4a-4c73-8154-de5fd5de41fb:375:33)
11userscript.html?name=My%2520Changes.user.js&id=a13e3485-0433-4107-a6a8-4eb56a3ac270:19 removing [object HTMLDivElement]

天音Author
§
Posted: 30/10/2022

I can't reproduce this error

Does it occurs every time?

If not, I think this only appears on specific tweets.

§
Posted: 02/11/2022
Edited: 02/11/2022

Surprise! I fixed it:

Put this on line 87, just below the "if (media) {" line:

try { // Need to test if href is null first, else this generates an uncaught TypeError during scrolling occasionally.
let _ = article.querySelector('a[href*="/status/"]').href.split('/status/').pop().split('/').shift();
}
catch{
return // Script assumes setting status_id was successful.
}


I had a fiddle with it and yeah i dunno why it was erroring but it seemed to be related to me scrolling the homepage really fast, and i'm using Edge. Either way it seems to be fixed now that there is an assertion that status_id is valid. If i see anything else funky i'll let ya know <3 Love the script man.

天音Author
§
Posted: 04/11/2022

yeah, i found the reason
the audio selector will match promotions
this is not twitter media content

will be fixed later

Post reply

Sign in to post a reply.