Aquí os traigo mi programa.
Lo que hace es que cuando tu colocas un link a megavideo en la caja de texto y le das a enviar crea un archivo html con el video embedido que genera la web Megavideo-No
Despues al pulsar Ver Video se abre tu navegador y se reproduce el video.
Link
Quise hacerlo con un webbrowser (lo de reproducir el video pero creo que no soporta flash asi que de momento eso es todo.
MegavideoNo.Class:
' gambas class file
PRIVATE Client AS NEW HttpClient AS "Client"
PUBLIC Buffer AS String
'http://www.megavideo.com/?v=4R2Y3TWF
PUBLIC SUB GetEmbedVideoCode(MegavideoUrl AS String)
'Crea un archivo HTML con el codigo del video embedido (Finished)
IF Mid(megavideourl, 1, 26) <> "http://www.megavideo.com/?" THEN
Message.Error("The specified URL is not a Megavideo link")
FMain.BtVer.Enabled = FALSE
RETURN
END IF
Client.Close
Client.Async = TRUE
Client.Timeout = 60
Client.URL = "http://www.megavideo-no.com/megavideo/"
Client.Post("application/x-www-form-urlencoded", "url=" & MegavideoUrl)
FMain.BtVer.Enabled = FALSE
END
PUBLIC SUB Client_Finished()
DIM Archivo AS File
'Leemos los datos descargados (HTML)
IF Lof(Client) THEN
READ #Client, Buffer, Lof(Client)
END IF
'comprobamos que no existan errores
IF InStr(Buffer, "Error locating download URL") THEN
Message.Error("Video does not exist")
FMain.BtVer.Enabled = FALSE
RETURN
ENDIF
'Modificamos el buffer para que quede el codigo html que deseamos
Buffer = "<html><head><title>Ver video sin resticciones</title></head><body><br><br><br><br><center><embed src=" & Between(Buffer, "<embed>") & "></center></body></html>"
'Creamos un archivo HTML con el codigo del video generado por la web
OPEN Application.Path & "/video.html" FOR WRITE CREATE AS #Archivo
PRINT #Archivo, Buffer
CLOSE #Archivo
'Poniendo los controles de los formularios como publicos
FMain.BtVer.Enabled = TRUE
END
PRIVATE FUNCTION Between(Datos AS String, Cadena1 AS String, Cadena2 AS String) AS String
DIM iinf AS Integer
DIM isup AS Integer
iinf = InStr(Datos, Cadena1) + Len(Cadena1)
isup = InStr(Datos, Cadena2, iinf)
RETURN Mid(Datos, iinf, isup - iinf)
END
PRIVATE Client AS NEW HttpClient AS "Client"
PUBLIC Buffer AS String
'http://www.megavideo.com/?v=4R2Y3TWF
PUBLIC SUB GetEmbedVideoCode(MegavideoUrl AS String)
'Crea un archivo HTML con el codigo del video embedido (Finished)
IF Mid(megavideourl, 1, 26) <> "http://www.megavideo.com/?" THEN
Message.Error("The specified URL is not a Megavideo link")
FMain.BtVer.Enabled = FALSE
RETURN
END IF
Client.Close
Client.Async = TRUE
Client.Timeout = 60
Client.URL = "http://www.megavideo-no.com/megavideo/"
Client.Post("application/x-www-form-urlencoded", "url=" & MegavideoUrl)
FMain.BtVer.Enabled = FALSE
END
PUBLIC SUB Client_Finished()
DIM Archivo AS File
'Leemos los datos descargados (HTML)
IF Lof(Client) THEN
READ #Client, Buffer, Lof(Client)
END IF
'comprobamos que no existan errores
IF InStr(Buffer, "Error locating download URL") THEN
Message.Error("Video does not exist")
FMain.BtVer.Enabled = FALSE
RETURN
ENDIF
'Modificamos el buffer para que quede el codigo html que deseamos
Buffer = "<html><head><title>Ver video sin resticciones</title></head><body><br><br><br><br><center><embed src=" & Between(Buffer, "<embed>") & "></center></body></html>"
'Creamos un archivo HTML con el codigo del video generado por la web
OPEN Application.Path & "/video.html" FOR WRITE CREATE AS #Archivo
PRINT #Archivo, Buffer
CLOSE #Archivo
'Poniendo los controles de los formularios como publicos
FMain.BtVer.Enabled = TRUE
END
PRIVATE FUNCTION Between(Datos AS String, Cadena1 AS String, Cadena2 AS String) AS String
DIM iinf AS Integer
DIM isup AS Integer
iinf = InStr(Datos, Cadena1) + Len(Cadena1)
isup = InStr(Datos, Cadena2, iinf)
RETURN Mid(Datos, iinf, isup - iinf)
END
Saludos.