XF 1.1 Converting Media Tags from vb3

Kintaro

Well-known member
In vb3 I use AME Automatic Media Embeding.

The problem is that AME have the possibility to restore link removing [AME] tags but it will restore it with [url] tags... plus some tags are like [AME=youtube]9MkB6NkQscI[/AME] and it will restore it like

[url]9MkB6NkQscI[/url]


do you suggest to maintain AME tags and replace them in a second moment?
 
For a replacement like that you can use this addon:

http://xenforo.com/community/threads/post-content-find-replace.6548/

Here are settings for your replacement. I tested this using the example in your post:

Quick Find: [ame

Regular expression: #\[ame="http:.+youtube.+v=(\w+)(&.+)?"\].+\[/ame\]#siU

Replacement String: [media=youtube]\1[/media]

View attachment 22866

@Jake Bunce

This got the majority of my old AME tags but still left quite a few :(

[ame=[media=youtube]o2_bwpCWO1g[/media] X - Another Pig Bites the Dust - YouTube[/ame]
[ame=[media=youtube]pPvlpc-AhTc[/media] X - Down So Long - YouTube[/ame]
[ame=[media=youtube]RwaJk-Xsjd8[/media] Rick,Primo & Cougnut "Tribute to Mr Cee" - YouTube[/ame]
[ame=[media=youtube]leB1b1vO6hQ[/media] - Bring It On - YouTube[/ame]

...etc
 
@Jake Bunce

This got the majority of my old AME tags but still left quite a few :(

[ame=[media=youtube]o2_bwpCWO1g[/media] X - Another Pig Bites the Dust - YouTube[/ame]
[ame=[media=youtube]pPvlpc-AhTc[/media] X - Down So Long - YouTube[/ame]
[ame=[media=youtube]RwaJk-Xsjd8[/media] Rick,Primo & Cougnut "Tribute to Mr Cee" - YouTube[/ame]
[ame=[media=youtube]leB1b1vO6hQ[/media] - Bring It On - YouTube[/ame]

...etc

Those posts have apparently been edited and subject to auto-media parsing. Those will be exceptions. It is easy to deal with those manually. Or you can run a custom replacement to fix them.
 
@JulianD

Quick Find: [ame

Regular expression: #\[ame(=".+")?\]http://www\.youtube\.com/watch\?v=([a-zA-Z0-9_\-]+?).*\[/ame\]#siU

Replacement String: [media=youtube]\2[/media]

Hi Jake, this one converted almost all my AME tags however these appear to be tricky:

Code:
[ame="http://m.youtube.com/watch?v=Gt50ua_9y3I"]http://m.youtube.com/watch?v=Gt50ua_9y3I[/ame]
[ame]http://m.youtube.com/watch?v=kv5dCXiXFaw[/ame]
[ame="http://www.youtube.com/watch?v=U1daYDlgAB8"][COLOR=#0066cc]http://www.youtube.com/watch?v=U1daYDlgAB8[/COLOR][/ame]
[ame="https://www.youtube.com/watch?v=YfkK51dYUbI"]Planetside 2[/ame]

Hope you can give me a hand with this!
 
@Super120

Quick Find: [ame

Regular expression: #\[ame(=".+")?\]http://m\.youtube\.com/watch\?v=([a-zA-Z0-9_\-]+?).*\[/ame\]#siU

Replacement String: [media=youtube]\2[/media]



Quick Find: [ame

Regular expression: #\[ame(=".+")?\]\[color=[^\]]+\]http://www\.youtube\.com/watch\?v=([a-zA-Z0-9_\-]+?).*\[/color\]\[/ame\]#siU

Replacement String: [media=youtube]\2[/media]



Quick Find: [ame

Regular expression: #\[ame="https://www\.youtube\.com/watch\?v=([a-zA-Z0-9_\-]+?)[^"]*"\][^\[]*\[/ame\]#siU

Replacement String: [media=youtube]\1[/media]
 
So I am running:
PHP:
[ame
#\[ame="http://www\.youtube\.com/watch\?v=([a-zA-Z0-9_\-] ?)[^"]*"\][^\[]*\[/ame\]#siU
[media=youtube]\1[/media]


but it doesn't convert:
PHP:
[ame]http://www.youtube.com/watch?v=Q7f2CPpFLGw[/ame]

why would this be?
 
* bump *

I'm working on migrating several vB 3.8 + AME sites to XF right now. I have tested Jake's suggestions and they find a lot of the codes, but each suggestion misses some...

Code:
#\[ame="http:.+youtube.+v=(\w+)(&.+)?"\].+\[/ame\]#siU
[media=youtube]\1[/media]

Doesn't handle ids (v=id) with dash or underscore, otherwise seems to find most [ame="addr"]title[/ame] codes

Code:
#\[ame\]http:.+youtube\.com/watch\?v=(\w+)(&.+)?\[/ame\]#siU
[media=youtube]\1[/media]

Doesn't handle ids with dash or underscore, otherwise seems to find most [ame]addr[/ame] codes

Code:
#\[ame(=".+")?\]http://www\.youtube\.com/watch\?v=([a-zA-Z0-9_\-]+?).*\[/ame\]#siU
[media=youtube]\2[/media]

Handles ids with dash and underscore, but only finds [ame="addr"]title[/ame] codes where the title is a url. Also hard codes //www into the url, so misses //m addresses.

So, I tried experimented with Jake's suggestions and the following codes (all using [media=youtube]\1[/media]) seem to catch everything:

Code:
#\[ame="http:.+youtube.+v=([a-zA-Z0-9_\-]+?).*\[/ame\]#siU
#\[ame="https:.+youtube.+v=([a-zA-Z0-9_\-]+?).*\[/ame\]#siU

#\[ame\]http:.+youtube\.com/watch\?v=([a-zA-Z0-9_\-]+?).*\[/ame\]#siU
#\[ame\]https:.+youtube\.com/watch\?v=([a-zA-Z0-9_\-]+?).*\[/ame\]#siU
 
Top Bottom