一键保存视频/图片
I can't reproduce this error
Does it occurs every time?
If not, I think this only appears on specific tweets.
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.
yeah, i found the reason
the audio selector will match promotions
this is not twitter media content
will be fixed later
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]