Shell script - Download - Mysql replace

Hi,

I have a video script. it has embedded Youtube videos. I want replace them downloaded version mp4 videos.

this script has a mysql table. I want search "url_flv" field on table a youtube link if has a youtube link I want download it this command.
I want extract uniq_id field for file name

youtube-dl -o '/home/videoscript/uploads/videos/123456.mp4' -f 18 http://www.youtube.com/watch?v=sFu5qXMuaJU

and I want replace mysql for downloaded versions:

original mysql:

table: pm_videos

fields:

id: 1200
uniq_id: 123456
url_flv: http://www.youtube.com/watch?v=sFu5qXMuaJU
source_id: 3

I want change them.

id: 1200
uniq_id: 123456
url_flv: 123456.mp4
source_id: 1

It's not clear what the relation of the youtube command and what appear
to be data from a mysql database. Please provide a better explantation.

it is solved thanks.