Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Move HTML parsing to a separate file for URL previews. #11566

Merged
merged 4 commits into from
Dec 13, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/11566.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Split the HTML parsing code from the URL preview resouce code.
clokep marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 2 additions & 3 deletions synapse/rest/media/v1/oembed.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import attr

from synapse.rest.media.v1.preview_html import parse_html_description
from synapse.types import JsonDict
from synapse.util import json_decoder

Expand Down Expand Up @@ -245,8 +246,6 @@ def calc_description_and_urls(open_graph_response: JsonDict, html_body: str) ->
if video_urls:
open_graph_response["og:video"] = video_urls[0]

from synapse.rest.media.v1.preview_url_resource import _calc_description

description = _calc_description(tree)
description = parse_html_description(tree)
if description:
open_graph_response["og:description"] = description
Loading