~metalune/simplynews_sites

2e706656ec4601762ea2e80445b96c15f53eec91 — bopol 3 days ago 3e12040
fix iframe links
2 files changed, 6 insertions(+), 1 deletions(-)

M simplynews_sites/helpers/utils.py
M simplynews_sites/lefigaro.py
M simplynews_sites/helpers/utils.py => simplynews_sites/helpers/utils.py +5 -0
@@ 10,3 10,8 @@ def value_in_element_attr(element, value, attr="class"):
            return value in element.attrs.get(attr)
        else:
            return False


def fix_link(link):
    if link.startswith("//"):
        return "https:{}".format(link)

M simplynews_sites/lefigaro.py => simplynews_sites/lefigaro.py +1 -1
@@ 218,7 218,7 @@ def get_element(element, is_live=False):
            iframe = data_html.select_one("iframe")
            if iframe is not None:
                el["type"] = "iframe"
                el["src"] = iframe["src"]
                el["src"] = utils.fix_link(iframe["src"])
                el["width"] = iframe.get("width")
                el["height"] = iframe.get("height")
                return el