…变成一个透明的盒子:
DOM显示:
<img src="" width="480" height="360" title=" - YouTube" style="aspect-ratio: 480 / 360;">
但是,发布时它们会渲染:
…变成一个透明的盒子:
DOM显示:
<img src="" width="480" height="360" title=" - YouTube" style="aspect-ratio: 480 / 360;">
但是,发布时它们会渲染:
确认,抓得好,我将暂时为此添加一个 pr-welcome 并给团队留个便条进行分类。
这是一个有趣的问题,我可以在 Meta 上重现 OP 中链接的问题,但在本地和我们的内部 Discourse 网站上,它们可以正常获取和呈现:
@rokejulianlockhart 这些链接在你自己的网站上无法正常呈现,还是仅仅在这里 Meta 上无法正常呈现?
@martin,其他人也遇到了类似问题:
然而,在 discussion.fedoraproject.org 上,它能够正常显示:
\u003cdetails open\u003e
使用 https://youtube.com/shorts/Cs3sTnLO6EE,可以复现以下问题:
…在以下位置可以复现:
然而,和之前一样,在 discussion.fedoraproject.org 上,它能够正常显示:
\u003c/details\u003e
Fedora 做了什么,让它们能正确显示?
此问题是否已解决?我为我的面板上当前遇到的类似问题开了一个主题。
@hameedacpa,这与那个完全无关,因为这是关于预览器的。此外,您可以通过简单地使用预览器来确认它尚未得到修复。我建议您安装一个翻译器。
@hameedacpa,这很相似,尽管我怀疑它是否等同。无效缩略图图标的存在似乎证明了这一点,以及<img>的不同纵横比。如果您将这些详细信息放入387672/1,它们将在那里有用。如果它们仅仅是浏览器引起的差异,它将被分类为该问题的部分重复。
话虽如此,请在引用的线程中包含您的浏览器版本、Discourse 版本以及渲染内容的实际标记。目前,除了屏幕截图之外,它什么都没有;您需要付出努力才能获得无偿帮助。
我们的 Onebox 流出现了一些问题,我认为与重定向/FinalDestination 有关。如果我像这样使用 curl:
curl -L https://youtube.com/shorts/Cs3sTnLO6EE
我能在响应中找到 title 和其他 meta 标签:
curl -L https://youtube.com/shorts/Cs3sTnLO6EE | htmlq 'head > meta'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 947221 0 947221 0 0 406174 0 --:--:-- 0:00:02 --:--:-- 504109
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="ApvK67ociHgr2egd6c2ZjrfPuRs8BHcvSggogIOPQNH7GJ3cVlyJ1NOq/COCdj0+zxskqHt9HgLLETc8qqD+vwsAAABteyJvcmlnaW4iOiJodHRwczovL3lvdXR1YmUuY29tOjQ0MyIsImZlYXR1cmUiOiJQcml2YWN5U2FuZGJveEFkc0FQSXMiLCJleHBpcnkiOjE2OTUxNjc5OTksImlzU3ViZG9tYWluIjp0cnVlfQ==" http-equiv="origin-trial">
<meta content="rgba(255, 255, 255, 0.98)" name="theme-color">
<meta content="A Screencast Of LinkedIn Persona Verification Failure" name="title">
<meta content="For https://www.linkedin.com/help/linkedin/cases/73171318#:~:text=Thanks%20for%20contacting%20us%20about,to%20troubleshoot%20any%20additional%20causes." name="description">
...
curl -L https://youtube.com/shorts/Cs3sTnLO6EE | htmlq 'head > title'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 992110 0 992110 0 0 445530 0 --:--:-- 0:00:02 --:--:-- 739941
<title>A Screencast Of LinkedIn Persona Verification Failure - YouTube</title>
然而,当通过我们的 oneboxer 代码获取响应时,这些是 <head> 中除(script + style)之外我们获得的唯一标签:
uri = FinalDestination.new("https://youtube.com/shorts/Cs3sTnLO6EE", Oneboxer.get_final_destination_options("https://youtube.com/shorts/Cs3sTnLO6EE")).resolve
doc2 = Onebox::Helpers.fetch_response(uri)
Nokogiri.HTML(doc2).css("head").children.each do |headel|
next if headel.name == "script" || headel.name == "style"
puts headel.to_s
end; nil;
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="origin-trial" content="ApvK67ociHgr2egd6c2ZjrfPuRs8BHcvSggogIOPQNH7GJ3cVlyJ1NOq/COCdj0+zxskqHt9HgLLETc8qqD+vwsAAABteyJvcmlnaW4iOiJodHRwczovL3lvdXR1YmUuY29tOjQ0MyIsImZlYXR1cmUiOiJQcml2YWN5U2FuZGJveEFkc0FQSXMiLCJleHBpcnkiOjE2OTUxNjc5OTksImlzU3ViZG9tYWluIjp0cnVlfQ==">
<link rel="shortcut icon" href="https://www.youtube.com/s/desktop/ace6261e/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://www.youtube.com/s/desktop/ace6261e/img/favicon_32x32.png" sizes="32x32">
<link rel="icon" href="https://www.youtube.com/s/desktop/ace6261e/img/favicon_48x48.png" sizes="48x48">
<link rel="icon" href="https://www.youtube.com/s/desktop/ace6261e/img/favicon_96x96.png" sizes="96x96">
<link rel="icon" href="https://www.youtube.com/s/desktop/ace6261e/img/favicon_144x144.png" sizes="144x144">
<link rel="stylesheet" href="//fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&family=YouTube+Sans:wght@300..900&display=swap" nonce="kFtYVVw9wWKkoPdOJkO9xQ">
<link rel="stylesheet" href="/s/player/65578ad1/www-player.css" nonce="kFtYVVw9wWKkoPdOJkO9xQ">
<link rel="stylesheet" href="https://www.youtube.com/s/desktop/ace6261e/cssbin/www-main-desktop-player-skeleton.css" nonce="kFtYVVw9wWKkoPdOJkO9xQ">
<link rel="stylesheet" href="https://www.youtube.com/s/desktop/ace6261e/cssbin/www-onepick.css" nonce="kFtYVVw9wWKkoPdOJkO9xQ">
<link rel="stylesheet" href="https://www.youtube.com/s/_/ytmainappweb/_/ss/k=ytmainappweb.kevlar_base.dsnGl9m3_bM.L.X.O/am=AAAgAAgk/d=0/rs=AGKMywEVyAGSU99VwQpoLFio5FrCvZ1WpA" nonce="kFtYVVw9wWKkoPdOJkO9xQ">
<meta name="theme-color" content="rgba(255, 255, 255, 0.98)">
<link rel="search" type="application/opensearchdescription+xml" href="https://www.youtube.com/opensearch?locale=en_US" title="YouTube">
<link rel="manifest" href="/manifest.webmanifest" crossorigin="use-credentials">
<link rel="canonical" href="undefined">
<link rel="alternate" media="handheld" href="https://m.youtube.com/shorts/Cs3sTnLO6EE">
<link rel="alternate" media="only screen and (max-width: 640px)" href="https://m.youtube.com/shorts/Cs3sTnLO6EE">
<title> - YouTube</title>
<meta name="title" content="">
<meta name="description" content="Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.">
<meta name="keywords" content="video, sharing, camera phone, video phone, free, upload">
<link rel="alternate" href="android-app://com.google.android.youtube/http/www.youtube.com/shorts/Cs3sTnLO6EE">
<link rel="alternate" href="ios-app://544007664/vnd.youtube/www.youtube.com/shorts/Cs3sTnLO6EE">
我曾以为是 ignore_redirects 导致了这个问题,但修改 FD 选项也没有效果:
我怀疑 YouTube 正在因为与大家相同的 AI 抓取问题而限制抓取,但不确定是什么具体原因导致我们收到空白响应(看起来就像在浏览器中访问时通过 JS 填充了 meta/title 标签)。
这段用于 YouTube oneboxing 的代码期望 title + image 标签被填充:
将继续调查 ![]()
会不会是他们为了节省带宽而只发送看起来有必要的内容?我们的 Oneboxes 使用浏览器用户代理,所以也许他们只是遵守了这一点?
好的,我认为我这里有一个修复方法,我们应该改用 YouTube 的 oEmbed 来处理这些内容:
我不这么认为,这似乎是两件事:
总的来说,oEmbed URL 似乎更安全,对于 OP 视频,它是 https://www.youtube.com/oembed?url=https://youtube.com/shorts/Cs3sTnLO6EE&format=json,你会得到类似这样的响应:
好的,该修复程序已合并,现在可以正常工作了 ![]()
请注意,onebox URL 的响应会被缓存 1 天,我必须在控制台中执行 Oneboxer.preview(“https://youtube.com/shorts/Cs3sTnLO6EE”, invalidate_oneboxes: true) 才能看到新的结果。
此主题在 2 天后自动关闭。不再允许回复。