MyBB Community Forums

Full Version: instagram mycode stopped working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Our instagram embed mycode has suddenly stopped working. 
Now just brings up a  "Instagram refused to connect" error

Code is below
Can anyone fix or suggest a working alternative? thnx

\[insta\]https://www.instagram.com/p/(.*?)/\[/insta\]

<div style="text-align:center">
<iframe src="//instagram.com/p/$1/embed/captioned/" width="612" height="800" frameborder="0" scrolling="auto" allowtransparency="true" style="border: 1px #b2a998 solid; border-radius: 5px; box-shadow: 0px 0px 7px 0px rgba(106, 101, 91, 0.5);"></iframe>
</div>
Yes it doesn't work. Any solutions please?
(2023-06-17, 02:04 PM)tolgacan Wrote: [ -> ]Yes it doesn't work. Any solutions please?

It works for me but mine is slightly different!
From an instagram link such as:

https://www.instagram.com/p/CtwhgBORbvK/?utm_source=ig_embed&utm_campaign=embed_video_watch_again

the members only type/paste one part from the above between the 'instagram' MyCode tags which would be (in the examples case):

CtwhgBORbvK


The regx is:

\[instagram\]([A-Za-z0-9]+)\[/instagram\]

and the replacement is:

<div style="text-align:center">
<iframe src="https://www.instagram.com/p/$1/embed/captioned/" width="612" height="800" frameborder="0" scrolling="auto" allowtransparency="true" style="border: 1px #b2a998 solid; border-radius: 5px; box-shadow: 0px 0px 7px 0px rgba(106, 101, 91, 0.5);"></iframe>
</div>

As said it works.
Hope this helps.
Cheers.

Seems to work.
You can use:
\[insta\]https://www.instagram.com/p/(.*)/.+\[/insta\]

The trouble with the first regexp is that it doesn't accept the query parameters (the ?utm_source=ig_embed&utm_campaign=embed_video_watch_again in the given example)
(2023-08-17, 01:59 PM)Crazycat Wrote: [ -> ]You can use:
\[insta\]https://www.instagram.com/p/(.*)/.+\[/insta\]

The trouble with the first regexp is that it doesn't accept the query parameters (the ?utm_source=ig_embed&utm_campaign=embed_video_watch_again in the given example)

Maybe you can help me with a question please!

The regx (.*?) means that near anything can be inserted into a MyCode and so must be insecure .... or is that not the case?

The given example was just a link I had at hand, not one which is setup to be entered into MyCode (but is one that some users try and put in) ... The example of mine was not a problem, it is just an example to show the 'part' of a link which is placed in the MyCode.
The ? following .* makes the regex lazy.
It's usefull if your url is https://www.instagram.com/p/IDYOUNEED/anything/else?utm_source....

Can you give examples of links wich doesn't work (anonymise the instagram id if you want)
(2023-08-17, 03:45 PM)Crazycat Wrote: [ -> ]The ? following .* makes the regex lazy.
It's usefull if your url is https://www.instagram.com/p/IDYOUNEED/anything/else?utm_source....

Can you give examples of links wich doesn't work (anonymise the instagram id if you want)

I cannot mate .... the problem in the OP was not mine, I just gave the way that I have it set up!

For me there is no problem as members just copy the single part of an instagram into the MyCode.
In the example you have given that would be:

IDYOUNEED

and that is all they do .... the simple regx in place will not allow anything else but upper case letters, lower case letters or numbers!
And as far as I know instagram only uses those in that part of the link! (if they add anything like a hyphen then I can add that to the simple regx)
Let OP answer: you don't have any trouble, I didn't saw you weren't OP.