Download Youtube Videos using Ruby or PHP
Just copy the appropriate script, provide the video_id
and run. It will list download links for different qualities and streams.
:P
<?php | |
function addWordHyphenation(string $str) { | |
$l = [ | |
'all' => "[абвгдеёжзийклмнопрстуфхцчшщъыьэюя]", | |
'glas' => "[аеёиоуыэю\я]", | |
'sogl' => "[бвгджзклмнпрстфхцчшщ]", | |
'zn' => "[йъь]", | |
'shy' => "­", | |
]; | |
$re = []; |
# SEO URL Settings | |
RewriteEngine On | |
# Redirect from www to non-www(https) | |
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] | |
RewriteRule ^(.*)$ https://%1/$1 [R=301,L] | |
# Redirect from http to https | |
RewriteCond %{HTTPS} off | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] |
# ------------------------------------ | |
# Docker alias and function | |
# https://github.com/tcnksm/docker-alias | |
# ------------------------------------ | |
# Get latest container ID | |
alias dl="docker ps -l -q" | |
# Get container process | |
alias dps="docker ps" |
const thisLine = () => { | |
const e = new Error(); | |
const regex = /\((.*):(\d+):(\d+)\)$/ | |
const match = regex.exec(e.stack.split("\n")[2]); | |
return { | |
filepath: match[1], | |
line: match[2], | |
column: match[3] | |
}; | |
} |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{HTTPS} off [OR] | |
RewriteCond %{HTTP_HOST} ^www\. [NC] | |
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC] | |
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301] | |
RewriteCond %{REQUEST_FILENAME} -s [OR] | |
RewriteCond %{REQUEST_FILENAME} -l [OR] | |
RewriteCond %{REQUEST_FILENAME} -d | |
RewriteRule ^.*$ - [NC,L] |
# SEO URL Settings | |
RewriteEngine On | |
# Redirect from www to non-www(https) | |
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] | |
RewriteRule ^(.*)$ https://%1/$1 [R=301,L] | |
# Redirect from http to https | |
RewriteCond %{SERVER_PORT} !^443$ | |
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L] |
<snippet> | |
<content><![CDATA[ | |
echo '<pre>'; print_r($1); echo '</pre>'; | |
]]></content> | |
<tabTrigger>preprint</tabTrigger> | |
<scope>source.php</scope> | |
</snippet> |
<?php | |
function decrement_letters($str) { | |
$letters = str_split($str); | |
$c = count($letters); | |
if ($c === 1) { | |
$letters[0] = $letters[0] === 'A' ? 'A' : chr(ord($letters[$c-1]) - 1); | |
} elseif($letters[$c-1] !== 'A') { | |
$letters[$c-1] = chr(ord($letters[$c-1]) - 1); |
/** | |
* 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\/)/); |