facebookarchive/facebook-instant-articles-sdk-php

Twitter Embed Code Issue

tapankumar opened this issue · 3 comments

Steps required to reproduce the problem (Script tag is being removed that is "<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>" )

HTML

<p style="text-align: justify;">Hello World</p>

<blockquote class="twitter-tweet" data-cards="hidden" data-lang="en">
<p dir="ltr" lang="en"><a href="https://twitter.com/hashtag/FLASH?src=hash" rel="nofollow">#FLASH</a>: Four Pakistani infiltrators killed by Army in Kupwara&#39;s Keran (Jammu and Kashmir), operation underway <a href="https://t.co/26K9DrqEPJ" rel="nofollow">pic.twitter.com/26K9DrqEPJ</a></p>
&mdash; ANI (@ANI_news) <a href="https://twitter.com/ANI_news/status/851273840713846786" rel="nofollow">April 10, 2017</a></blockquote>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

<p style="text-align: justify;">Hello World !!!</p>
Transformation Rule:
{
                    "class": "InteractiveRule",
                    "selector": "blockquote.twitter-tweet",
                    "properties": {
                        "interactive.iframe": {
                            "type": "element",
                            "selector": "blockquote"
                        }
                    }
                },

Expected Result


<iframe class="no-margin"><blockquote class="twitter-tweet" data-cards="hidden" data-lang="en">
--
  | <p dir="ltr" lang="en"><a href="https://twitter.com/hashtag/FLASH?src=hash" rel="nofollow">#FLASH</a>: Four Pakistani infiltrators killed by Army in Kupwara's Keran (Jammu and Kashmir), operation underway <a href="https://t.co/26K9DrqEPJ" rel="nofollow">pic.twitter.com/26K9DrqEPJ</a></p>
  | — ANI (@ANI_news) <a href="https://twitter.com/ANI_news/status/851273840713846786" rel="nofollow">April 10, 2017</a></blockquote>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
</iframe>


Actual Result


<iframe class="no-margin"><blockquote class="twitter-tweet" data-cards="hidden" data-lang="en">
--
  | <p dir="ltr" lang="en"><a href="https://twitter.com/hashtag/FLASH?src=hash" rel="nofollow">#FLASH</a>: Four Pakistani infiltrators killed by Army in Kupwara's Keran (Jammu and Kashmir), operation underway <a href="https://t.co/26K9DrqEPJ" rel="nofollow">pic.twitter.com/26K9DrqEPJ</a></p>
  | — ANI (@ANI_news) <a href="https://twitter.com/ANI_news/status/851273840713846786" rel="nofollow">April 10, 2017</a></blockquote></iframe>



This is now resolved.

Hello, I'm facing the same issue @tapankumar can you please explain how this has fixed.

  1. "InteractiveRule" add an iframe for embed the tweet
  2. Selector is your node where is the tweet in your HTML code
  3. Properties define the iframe