# CNN oneboxing failure

**URL:** https://meta.discourse.org/t/cnn-oneboxing-failure/295831
**Category:** Bug
**Tags:** onebox
**Created:** [February 18, 2024, 11:29pm UTC](https://meta.discourse.org/t/cnn-oneboxing-failure/295831 "2024-02-18T23:29:34Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![wazroth](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wazroth/32/364019_2.png) [@wazroth](https://meta.discourse.org/u/wazroth)
#### Post date: [February 18, 2024, 11:29pm UTC](https://meta.discourse.org/t/cnn-oneboxing-failure/295831/1 "2024-02-18T23:29:34Z")

</div>

Over on another Discourse forum, @sam suggested I make a bug report here: There seems to be (at least) intermittent failure of oneboxing of CNN articles. Since this is a high-profile site, it seems pretty significant. Unclear whether it’s a rate-limiting issue, a user-agent block, a Discourse-side issue, an actual problem with the oEmbed data, or what.

Examples:

> **[Takeaways from the $355 million civil fraud ruling against Donald Trump | CNN...](https://www.cnn.com/2024/02/16/politics/takeaways-donald-trump-fraud-ruling/index.html)**
>
> Judge Arthur Engoron hit Donald Trump with his biggest punishment to date on Friday, in a ruling that fined the former president $355 million for fraudulently inflating the values of his properties.

> **[Analysis: Taylor Swift would win any popularity contest against MAGA | CNN...](https://www.cnn.com/2024/02/18/politics/taylor-swift-maga-popular/index.html)**
>
> Some fans of former President Donald Trump believe pop star Taylor Swift has been employed in a kind of covert government operation to prop up Joe Biden’s reelection bid and have therefore tried to stigmatize her.

(Additional examples removed due to New Userness.)

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [February 18, 2024, 11:46pm UTC](https://meta.discourse.org/t/cnn-oneboxing-failure/295831/2 "2024-02-18T23:46:40Z")

</div>

Hi @wazroth 👋 welcome to Meta. 🙂 Thanks for the report.

Yea I have been able to repro this on my dev instance and a hosted site. CNN links not oneboxing at all.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 19, 2024, 12:25am UTC](https://meta.discourse.org/t/cnn-oneboxing-failure/295831/3 "2024-02-19T00:25:09Z")

</div>

Thanks @wazroth we have debugging this slotted to some time in the next 4 weeks

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [May 7, 2024, 6:05am UTC](https://meta.discourse.org/t/cnn-oneboxing-failure/295831/7 "2024-05-07T06:05:18Z")

</div>

@ted Do you happen to remember why we reduced `max_download_kb` for onebox from 10mb to 2mb in [SECURITY: Prevent Onebox cache overflow by limiting downloads and URL… · discourse/discourse@95a82d6 · GitHub](https://github.com/discourse/discourse/commit/95a82d608d6377faf68a0e2c5d9640b043557852)?

The reported CNN links are not being oneboxed because the response size is 2.7mb which is greater than the current limit of 2mb. We can fix this by raising the default size but I would like to better the understand the risk of doing so.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [May 7, 2024, 6:29am UTC](https://meta.discourse.org/t/cnn-oneboxing-failure/295831/8 "2024-05-07T06:29:36Z")

</div>

hmmm also … to follow on, isn’t all the info we need in the first 2mb anyway?

---

<div class="post-metadata">

### Author: ![Wingtip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wingtip/32/102039_2.png) [@Wingtip](https://meta.discourse.org/u/Wingtip)
#### Post date: [May 7, 2024, 5:11pm UTC](https://meta.discourse.org/t/cnn-oneboxing-failure/295831/9 "2024-05-07T17:11:54Z")

</div>

See also [Amazon Onebox broken](https://meta.discourse.org/t/amazon-onebox-broken/307120), possibly related?

---

<div class="post-metadata">

### Author: ![Richie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/richie/32/115110_2.png) [@Richie](https://meta.discourse.org/u/Richie)
#### Post date: [May 7, 2024, 5:27pm UTC](https://meta.discourse.org/t/cnn-oneboxing-failure/295831/10 "2024-05-07T17:27:07Z")

</div>

> [@tgxworld](#):
>
> Do you happen to remember why we reduced `max_download_kb` for onebox from 10mb to 2mb

Is this `max_download_kb` setting hard coded? It’s nothing something I can change via the admin menu is it?

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [May 8, 2024, 4:10am UTC](https://meta.discourse.org/t/cnn-oneboxing-failure/295831/11 "2024-05-08T04:10:33Z")

</div>

Depends on the onebox engine. Some onebox engines like Amazon scrapes for certain information like the price of the item from within the `<body>`. For opengraph engines, we should in theory only need certain tags like `<meta>` in `<head>`.

The most efficient way will be to parse the response for the necessary information as we stream the response but changing all our engines to do this is likely going to take a considerable amount of effort and is a much more complex solution.

Actually, Nokogiri which we use to parse the HTML response is capable of parsing incomplete HTML text so there is no need to throw away the entire response when it is too large. I think we can just continue to limit the response body to 2mb and if the response size exceeds that, we just try to parse the first 2mb.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [May 8, 2024, 5:33am UTC](https://meta.discourse.org/t/cnn-oneboxing-failure/295831/12 "2024-05-08T05:33:07Z")

</div>

This is fixed by

[https://github.com/discourse/discourse/pull/26929](https://github.com/discourse/discourse/pull/26929)

Locally, the “problematic” URLs reported in this topic no longer displays an error when we try to onebox.

 ![Screenshot 2024-05-08 at 1.31.25 PM](https://global.discourse-cdn.com/meta/original/4X/3/c/a/3ca45971b4d1e6b229a5a51affe8094f038111bc.png)

---

<div class="post-metadata">

### Author: ![Richie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/richie/32/115110_2.png) [@Richie](https://meta.discourse.org/u/Richie)
#### Post date: [May 8, 2024, 9:53am UTC](https://meta.discourse.org/t/cnn-oneboxing-failure/295831/13 "2024-05-08T09:53:10Z")

</div>

Fantastic, thanks @tgxworld😃

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [May 8, 2024, 11:31pm UTC](https://meta.discourse.org/t/cnn-oneboxing-failure/295831/15 "2024-05-08T23:31:03Z")

</div>


