Twitter 媒体下载

一键保存视频/图片

< 脚本Twitter 媒体下载的反馈

评价:好评 - 脚本运行良好

§
发表于:2022-10-30
编辑于:2022-10-30

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]

天音作者
§
发表于:2022-10-30

I can't reproduce this error

Does it occurs every time?

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

§
发表于:2022-11-02
编辑于:2022-11-02

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.

天音作者
§
发表于:2022-11-04

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

will be fixed later

发表回复

登录以发表回复。