Chat youtube url system for embed

Asked

Viewed 591 times

1

Good afternoon, I’m trying to create a system, where I receive a youtube url in a form, convert it to embed and save it in a database. This is a classified site, I do not know if this is the best way, I did not want to spend a lot of space in the accommodation so I opted for youtube videos, be better to ask the user directly the embed link, if someone can explain me how to create the chat system? Thank you.

  • You can only record the youtube video code in the database, and at the time of displaying, inside the while you enter the entire embed code, and just change the /embed/D_e58tnujrs by the /embed/<? echo $Row['youtube']; ?>

1 answer

1

Embed link from youtube: https://www.youtube.com/embed/[id_do_video]
Example: https://www.youtube.com/embed/D_E58tNUJRs

And in case you get recent youtube videos use the Googleapi and collect the link from the feed of recent/highest rated videos.

Here https://stackoverflow.com/questions/22613903/youtube-api-v3-get-list-of-users-videos has this link that can help you in search for videos of the channels.

And to add the value to the database (I will be using mysql in this case because it is less complicated to work) use this [php and mysql]:

<?php 
// conecta com o servidor 
$mysql_conexao = mysql_connect(servidor, usuario, senha);

// prepara o comando
$exec = "INSERT INTO nome_da_tabela (coluna1, coluna2) VALUES (value1, value2)";

// executa e verifica o comando 
if($mysql_conexao->query($exec) == TRUE){ //inserido com sucesso! }

?>
  • only remembering column1, column2 will be in the case the names of the columns.

  • same with values1, values2

  • Thank you, my doubt was more in the conversational system

Browser other questions tagged

You are not signed in. Login or sign up in order to post.