From 96ad2a323aafb4e946da70a9e33b4ae72ac61695 Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Sun, 29 Oct 2017 00:45:46 +0300 Subject: [PATCH] Initial --- .gitignore | 1 + LICENSE | 21 ++++++++++++++++++ README.md | 5 +++++ index.html | 34 +++++++++++++++++++++++++++++ styles.css | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ youtubeID.js | 35 ++++++++++++++++++++++++++++++ ytcg.js | 7 ++++++ 7 files changed, 163 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 index.html create mode 100644 styles.css create mode 100644 youtubeID.js create mode 100644 ytcg.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..07a7ed1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +y.js diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0d83115 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Alexander Popov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..5dca4c8 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +YTCget +------ + +**Thanks:** ++ @takien: for [youtubeID.js](https://gist.github.com/takien/4077195) script. diff --git a/index.html b/index.html new file mode 100644 index 0000000..be35b17 --- /dev/null +++ b/index.html @@ -0,0 +1,34 @@ + + + + + + YTCget + + + + + + + + + +
+
+
+ +
+
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/styles.css b/styles.css new file mode 100644 index 0000000..94d2ad5 --- /dev/null +++ b/styles.css @@ -0,0 +1,60 @@ +@import url('https://fonts.googleapis.com/css?family=Roboto:400,700&subset=cyrillic'); + +* { + padding: 0; margin: 0; outline: 0; + font-family: "Roboto"; + font-size: 1.1rem; +} + +body { + background-color: #121212; +} + +div.wrap { + max-width: 800px; + margin: 0 auto; +} + +div.header { + background-color: #232323; + padding: 16px; +} + +div.content { + margin-top: 10px; +} +div.content img { + border: 1px solid #808080; + max-width: 100%; +} + +input, button { + box-sizing: border-box; + border: 1px solid #121212; + background-color: #232323; + font-size: 1rem; + padding: 8px; +} + +input { + width: calc(100% - 100px); + color: #808080; +} + +input::placeholder { + color: #818181; +} +input:focus { + background-color: #606060; + color: #ffffff; +} + +button { + background-color: #343434; + color: #606060; + border-left: 0; + width: 100px; +} +button:hover { + color: #808080; +} diff --git a/youtubeID.js b/youtubeID.js new file mode 100644 index 0000000..9818635 --- /dev/null +++ b/youtubeID.js @@ -0,0 +1,35 @@ +/** +* Get YouTube ID from various YouTube URL +* @author: takien +* @url: http://takien.com +* For PHP YouTube parser, go here http://takien.com/864 +*/ + +function YouTubeGetID(url){ + var ID = ''; + url = url.replace(/(>|<)/gi,'').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/); + if(url[2] !== undefined) { + ID = url[2].split(/[^0-9a-z_\-]/i); + ID = ID[0]; + } + else { + ID = url; + } + return ID; +} + + +/* +* Tested URLs: + +var url = 'http://youtube.googleapis.com/v/4e_kz79tjb8?version=3'; +url = 'https://www.youtube.com/watch?feature=g-vrec&v=Y1xs_xPb46M'; +url = 'http://www.youtube.com/watch?feature=player_embedded&v=Ab25nviakcw#'; +url = 'http://youtu.be/Ab25nviakcw'; +url = 'http://www.youtube.com/watch?v=Ab25nviakcw'; +url = ''; +url = ''; +url = 'http://i1.ytimg.com/vi/Ab25nviakcw/default.jpg'; +url = 'https://www.youtube.com/watch?v=BGL22PTIOAM&feature=g-all-xit'; +url = 'BGL22PTIOAM'; +*/ diff --git a/ytcg.js b/ytcg.js new file mode 100644 index 0000000..6890c9f --- /dev/null +++ b/ytcg.js @@ -0,0 +1,7 @@ +function getCover() +{ + var videoUrl = document.getElementById('videoUrl').value; + var coverUrl = 'https://img.youtube.com/vi/' + YouTubeGetID(videoUrl) + '/maxresdefault.jpg'; + document.getElementById('ytImage').innerHTML = + ''; +}