I called YouTube video from DB with haml and tried to embed and display it

The method I found when I tried to embed and display YouTube videos with my own application

I wanted to save my favorite video in the DB once by creating my own application and embed it when calling it, so I will introduce various methods I searched for.

General embedding method

Choose where to share your favorite YouTube videos

スクリーンショット 2020-07-12 16.16.00.png

Then embed it and choose the one スクリーンショット 2020-07-12 16.16.33.png

The URL for embedding the video will appear, so click Copy スクリーンショット 2020-07-12 16.16.59.png

Complete by pasting this directly into HTML (haml)

The finished product looks like this スクリーンショット 2020-07-12 16.21.46.png

However, when I posted it to the DB and tried to call it from the haml file, it came out as a character string, so this is a way to solve it.

The way I actually went

%iframe#player{frameborder: "0", height:"390", src: (movie.url), type: "text/html", width: "640"}
* This time, I made a movie model and set the column name to url.

Put simply, ・ Save the outer frame as a haml file (size etc. can be changed as you like) ・ Save only the URL part in the DB → call it -Save titles and contents in separate columns

By doing this, it was possible to embed the display when posting to the DB → calling.

Actual image (although still under development)

スクリーンショット 2020-07-12 16.36.11.png ↑ I was able to implement everything safely with the posting function (cracking)

One point to note

This is the URL I used, but it's underlined in blue (no double quotes needed) スクリーンショット 2020-07-12 16.38.35.png

スクリーンショット 2020-07-12 16.16.33.png

The blue underlined URL here didn't work. Probably because it is not the URL for embedding.

As mentioned above, I hope it will be helpful for those who want to implement the same.

Recommended Posts

I called YouTube video from DB with haml and tried to embed and display it
I tried to verify whether it would be fun to combine "programming" and "hobbies".
I called YouTube video from DB with haml and tried to embed and display it
I tried to get started with Spring Data JPA
I tried to read and output CSV with Outsystems
I started MySQL 5.7 with docker-compose and tried to connect
roman numerals (I tried to simplify it with hash)
Get video information from Nikorepo and throw it to Slack
I tried upgrading from CentOS 6.5 to CentOS 7 with the upgrade tool
I tried to interact with Java
Convert Excel to Blob with java, save it, read it from DB and output it as a file!
I created and set my own Dialect with Thymeleaf and tried using it
I want to display images with REST Controller of Java and Spring!
I tried to make a Web API that connects to DB with Quarkus
I tried to measure and compare the speed of GraalVM with JMH
I tried to get started with WebAssembly
I tried to build Ruby 3.0.0 from source
I tried to implement ModanShogi with Kinx
I built a CentOS 8 environment with Vagrant and tried to sync_folder, but I got an error, so I solved it.
Get YouTube video information with Retrofit and keep it in the Android app.
I tried to verify whether it would be fun to combine "programming" and "hobbies".
I tried to get the distance from the address string to the nearest station with ruby
I tried to automatically generate a class to convert from a data class to a Bundle with APT
[JDBC ③] I tried to input from the main method using placeholders and arguments.
When I tried to use a Wacom tablet with ubuntu 20.04, I didn't recognize it.
I tried to convert JavaBean and XML with Jackson formatter XML in this era
I tried to verify AdoptOpenJDK 11 (11.0.2) with Docker image
I tried to make Basic authentication with Java
[Rails] I tried to raise the Rails version from 5.0 to 5.2
I tried to manage login information with JMX
I tried to link grafana and postgres [docker-compose]
I also tried WebAssembly with Nim and C
I want to play with Firestore from Rails
I tried to link JavaFX and Spring Framework.
I tried to break a block with java (1)
I tried to create a shopping site administrator function / screen with Java and Spring
I want to morphologically analyze the log in the DB and put it in the DB to classify messages 1
When I tried to support IPv6 easily with Docker-proxy, I couldn't do it before I knew it.
I tried to investigate the mechanism of Emscripten by using it with the Sudoku solver
I tried what I wanted to try with Stream softly.
I tried to implement file upload with Spring MVC
I tried to implement TCP / IP + BIO with JAVA
[Java 11] I tried to execute Java without compiling with javac
I tried to integrate AWS I oT button and Slack
How to embed youtube videos using iframe tags (haml)
I tried to get started with Spring Data JPA
[How to insert a video in haml with Rails]
I tried to draw animation with Blazor + canvas API
I tried to implement Stalin sort with Java Collector
I want to transition screens with kotlin and java!
I want to redirect sound from Ubuntu with xrdp
I tried to chew C # (reading and writing files)
I tried to develop a web application from a month and a half of programming learning history
Easy to make LINE BOT with Java Servlet Part 2: I tried image messages and templates
When I tried to run Azure Kinect DK with Docker, it was blocked by EULA