# How to refetch an embedded post

**URL:** https://meta.discourse.org/t/how-to-refetch-an-embedded-post/130137
**Category:** Support
**Tags:** embedding
**Created:** [October 3, 2019, 1:50pm UTC](https://meta.discourse.org/t/how-to-refetch-an-embedded-post/130137 "2019-10-03T13:50:44Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Christoph\_Holtermann](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/christoph_holtermann/32/78076_2.png) [@Christoph\_Holtermann](https://meta.discourse.org/u/Christoph_Holtermann)
#### Post date: [October 3, 2019, 1:50pm UTC](https://meta.discourse.org/t/how-to-refetch-an-embedded-post/130137/1 "2019-10-03T13:50:44Z")

</div>

I have embedded discourse on my site ([Embed Discourse comments on another website via Javascript - #309 by eviltrout](https://meta.discourse.org/t/embedding-discourse-comments-via-javascript/31963/309)). Discourse creates posts containing a preview of my site. How can I recreate / refetch such an embedded post as I changed the crawler parameters and I’d like to refetch the preview of the page where discourse is embedded?

Would rebaking help? Is there a command in the console?

I found that

`TopicEmbed.find_remote(url)`

seems to be useful to show what would be fetched.

---

<div class="post-metadata">

### Author: ![Christoph\_Holtermann](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/christoph_holtermann/32/78076_2.png) [@Christoph\_Holtermann](https://meta.discourse.org/u/Christoph_Holtermann)
#### Post date: [October 4, 2019, 6:52am UTC](https://meta.discourse.org/t/how-to-refetch-an-embedded-post/130137/2 "2019-10-04T06:52:09Z")

</div>

Looking through the source I found this to be a working solution:

```
username = SiteSetting.embed_by_username.downcase
user = User.where(username_lower: username.downcase).first
embed_url = "http://www.example.org" # or use the url from topic as shown below
TopicEmbed.import_remote(user, embed_url)

```

taken from **TopicRetriever.fetch\_http** ([discourse/lib/topic\_retriever.rb at 888e68a1637ca784a7bf51a6bbb524dcf7413b13 · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/888e68a1637ca784a7bf51a6bbb524dcf7413b13/lib/topic_retriever.rb#L48))

where embed\_url is the url of the site where discourse is embedded, coming from the topic with the number topic\_id this may be

```
embed_url = TopicEmbed.where(topic: topic_id)[0].embed_url

```

This seems a bit complicated to just refetch. Is it correct anyway? Is there a simpler possibility?

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [June 3, 2023, 3:13am UTC](https://meta.discourse.org/t/how-to-refetch-an-embedded-post/130137/3 "2023-06-03T03:13:48Z")

</div>



---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [June 3, 2023, 7:12am UTC](https://meta.discourse.org/t/how-to-refetch-an-embedded-post/130137/4 "2023-06-03T07:12:17Z")

</div>


