# 因格式错误的 404 导致的奇怪 onebox 失败

**URL:** <https://meta.discourse.org/t/strange-onebox-failure-due-to-malformed-404/112310>\
**Category:** Product Support\
**Tags:** onebox\
**Created:** [2019 年3 月 22 日 09:23 UTC](https://meta.discourse.org/t/strange-onebox-failure-due-to-malformed-404/112310 "2019-03-22T09:23:52Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

作者： ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)\
发布日期： [2019 年3 月 22 日 09:45 UTC](https://meta.discourse.org/t/strange-onebox-failure-due-to-malformed-404/112310/4 "2019-03-22T09:45:13Z")

</div>

```
2019-03-22 10:42:42 - MultiJson::ParseError - 767: unexpected token at '<head>
<title>404 Not Found</title>
</head><body>
<h1>404 Not Found</h1>
  <p>The provided content is neither a Video Release nor does it contain a Video Release in Related Media.<br>Example Request Format: https://www.nbcnewyork.com/services/oembed/?url=https://www.nbcnewyork.com/sample/path/Sample-Article-Example-12345678.html</p>
</body></html>

      ':
	/Users/joffreyjaffeux/.rubies/ruby-2.6.1/lib/ruby/2.6.0/json/common.rb:156:in `parse'
	/Users/joffreyjaffeux/.rubies/ruby-2.6.1/lib/ruby/2.6.0/json/common.rb:156:in `parse'
	/Users/joffreyjaffeux/.gem/ruby/2.6.1/gems/multi_json-1.13.1/lib/multi_json/adapters/json_common.rb:14:in `load'
	/Users/joffreyjaffeux/.gem/ruby/2.6.1/gems/multi_json-1.13.1/lib/multi_json/adapter.rb:21:in `load'
	/Users/joffreyjaffeux/.gem/ruby/2.6.1/gems/multi_json-1.13.1/lib/multi_json.rb:122:in `load'
	/Users/joffreyjaffeux/Projects/onebox/lib/onebox/oembed.rb:6:in `initialize'

```

> <https://github.com/discourse/onebox/blob/main/lib/onebox/oembed.rb#L5>

We are trying to get oembed content from [CVS to Sell CBD Products in 800 Stores in 8 States – NBC New York](https://www.nbcnewyork.com/services/oembed/?url=https://www.nbcdfw.com/news/health/CVS-to-Sell-CBD-Products-in-800-Stores-in-8-States-507484191.html) which is a 404

The thing is, this URL comes from their page source:

```plaintext
<link rel="alternate" type="application/json+oembed"
    href="https://www.nbcnewyork.com/services/oembed/?url=https://www.nbcsandiego.com/news/national-international/CVS-to-Sell-CBD-Products-in-800-Stores-in-8-States-507484191.html"
    title="CVS to Sell CBD Products in 800 Stores in 8 States - NBC 7 San Diego " />

```

So I would day the bug is from them, not us.

---

_[View the full topic](https://meta.discourse.org/t/strange-onebox-failure-due-to-malformed-404/112310)._
