I修改了代码,以直接使用Twitter的官方嵌入URL。
这里是工作解决方案:{
name: "twitter",
url: /^twitter\.com\/([\w.-]+)\/status\/(\d+)$/,
html: (match) => {
const id = match[2];
return (
'<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;">' +
`<iframe src="https://platform.twitter.com/embed/Tweet.html?id=${id}" loading="lazy"` +
' style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" ' +
' frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>' +
"</iframe>" +
"</div>"
);
},
},
更改为platform.twitter.com