iaresee
Active member
I'm in the process of migrating a largish VB4 site to Xenforo that has a lot of YouTube and SoundCloud embedded media links in the post content. The Post Content Find/Replace add-on and the regex tips from @Jake Bunce are a great tools, but it was falling over trying to read a database as large as the one I have.
So I wrote a command line utility to do the conversion. You can get it here: https://github.com/ianchesal/xenforo-conversion
It's part of what will be larger suite of tools that I'm using to do the conversion, but for now that's the first piece I'm putting out as open source.
There are a bunch of examples for common media embeds in the README file.
Here's an example that'll do YouTube embeds in your post content for you:
That'll find stuff like:
And convert it to:
The script can be run against large sites with on a machine with minimal memory thanks to batch fetching of results.
Props to @Kier for the idea to pre-limit the number of posts you need to run the actual regex on with an initial search expression. That's a nice optimization.
So I wrote a command line utility to do the conversion. You can get it here: https://github.com/ianchesal/xenforo-conversion
It's part of what will be larger suite of tools that I'm using to do the conversion, but for now that's the first piece I'm putting out as open source.
There are a bunch of examples for common media embeds in the README file.
Here's an example that'll do YouTube embeds in your post content for you:
Code:
bundle exec bin/find_and_replace --yes '[video' '\[video=youtube\S*?;(\S+?)\].*?\[\/video\]' '[media=youtube]\1[/media]'
That'll find stuff like:
Code:
[video=youtube;t4KIAWNZ5tY]http://www.youtube.com/watch?v=t4KIAWNZ5tY[/video]
[video=youtube_share;RkkCDHmBAs8]http://youtu.be/RkkCDHmBAs8[/video]
And convert it to:
Code:
[media=youtube]t4KIAWNZ5tY[/media]
[media=youtube]RkkCDHmBAs8[/media]
The script can be run against large sites with on a machine with minimal memory thanks to batch fetching of results.
Props to @Kier for the idea to pre-limit the number of posts you need to run the actual regex on with an initial search expression. That's a nice optimization.