如何重新获取嵌入式帖子

我在我的网站上嵌入了 Discourse(https://meta.discourse.org/t/embedding-discourse-comments-via-javascript/31963/309)。Discourse 会生成包含我网站预览的帖子。由于我更改了爬虫参数,想要重新获取嵌入 Discourse 所在页面的预览,该如何重新创建或重新获取这样的嵌入帖子?

重新烘焙(rebaking)会有帮助吗?控制台中有相关命令吗?

我发现:

TopicEmbed.find_remote(url)

似乎可以用来查看将要获取的内容。

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)

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?