thalassa/examples/ytid/ytid_conf.ini
2026-03-19 06:23:52 +05:00

160 lines
5.0 KiB
INI

[general]
default_url = https://%site_id%/
default_watch_url = https://%site_id%/watch?v=%video_id%
cookie_name = ytid_site_choice
[html]
# Replace ``http'' with ``https'' if you use https.
# Add the port number if you use a non-standard port.
mysite = http://%req:host%
[html]
header = <?xml version="1.0" encoding="us-ascii"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+<link type="text/CSS" rel="stylesheet" href="/ytid.css" />
+<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
+<title>Access youtube content the way you choose</title>
+</head> <body>
+
footer = </body></html>
+
yttn = https://img.youtube.com/vi/%0%/default.jpg
[errorpage]
# the error page template can use macros provided by the dullcgi framework,
# that is, ``common'' macros of Thalassa CMS and the macros added by the
# framework, namely %html:%, %req:% and %getenv:%
#
# besides that, three local macros are defined here:
# %errcode% - the 3-digit error code such as 404, 501 etc
# %errmessage% - short human-readable error message
# %progname% - the CGI program name, as defined by dullcgi_program_name
#
# please note no ``custom'' macros (added by the dullcgi_main function)
# should ever be used here, because the error page may in some cases be
# composed before calling that function
template = %html:header%
+<h2 style="margin:2em;">%errcode% %errmessage%</h2>
+<a href="/">To the main page of the site</a> &bullet;
+<a href="%[req:script]">Choose another video to watch</a>
+<hr />
+%html:footer%
[redirectpage]
template = %html:header%
+<h2>Redirecting to %url%...</h2>
+<a href="%url%">Click here if your browser doesn't redirect automatically</a>
+%html:footer%
[page form]
template = %html:header%
+<h2>Watch videos where you like</h2>
+<p>This script allows you to watch YouTube videos using alternative
+ access facilities known as
+ <a href="https://invidious.io/">Invidious</a>. Just type the
+ video ID or a whole YouTube URL (e.g., if someone sent you a
+ link, you can just copy/paste the link) and press the "Go!" button.
+ You'll be present with a form that lets you choose where to
+ watch.</p>
+<form action="%[req:script]" method="get" accept-charset="ascii,us-ascii">
+ <label for="input_id">Please type the youtube id or URL:</label>
+ <input type="text" name="v" id="input_id" size="60" />
+ <input type="submit" value="Go!" />
+</form>
+<hr />
+<p>The ytid.cgi program is a part of
+ <a href="http://thalassa.croco.net">Thalassa CMS</a>
+</p>
+%html:footer%
[html]
siteitem = <option %[collapsews:
+ %[ifeq:%site_choice%:%0%:selected="selected"]
+value=%[q:%0%]>]%0%</option>
+
[page choice]
template = %html:header%
+<h2>YouTube video <code>%ytid%</code></h2>
+<img src="https://img.youtube.com/vi/%ytid%/hqdefault.jpg"
+ alt="video thumbnail" class="yttn" />
+<div class="infocol">
+<a href="https://youtu.be/%ytid%" class="biglink">Watch on YouTube</a>
+%[ifchoice|
+<form action="%[req:script]" method="get">
+ <fieldset class="chform">
+ <legend>Your invidious instance of choice</legend>
+ <p>Your choosen site is
+ <a href="%[site_url|%site_choice%]">%site_choice%</a></p>
+ <input type="hidden" name="v" value=%[q:%[ytid]]>
+ <button type="submit" name="mode" value="forget">Forget
+ the choice</button>
+ </fieldset>
+</form>
+<a href="%[watch_url|%site_choice%|%ytid%]"
+ class="biglink">Watch on %site_choice%</a>
+]
+<form action="%[req:script]" method="get">
+ <fieldset class="chform">
+ <legend>Random invidious instance</legend>
+ <p>The random instance is
+ <a href="%[site_url|%random_site%]">%random_site%</a></p>
+ </fieldset>
+</form>
+<a href="%[watch_url|%random_site%|%ytid%]"
+ class="biglink">Watch on %random_site%</a>
+<form action="%[req:script]" method="get">
+ <fieldset class="chform">
+ <legend>Choose invidious instance</legend>
+ <input type="hidden" name="v" value=%[q:%[ytid]]>
+ <table><tr><td>
+ <select name="site" id="site_selection">
+ <option value="">-- choose invidiou site --</option>
+ %[foreach:%[sites]:html:siteitem]
+ </select></td><td>
+ <button type="submit" name="mode" value="choose">Save the choice</button>
+ </td></tr><tr><td></td><td>
+ <button type="submit" name="mode" value="watch">Watch there</button>
+ </td></tr><tr><td></td><td>
+ <button type="submit" name="mode"
+ value="setwatch">Save &amp; watch</button>
+ </td></tr></table>
+ </fieldset>
+</form>
+</div>
+<p>Saving the choice sets a cookie! Please don't press these buttons
+ if you don't like cookies.</p>
+<hr />
+<p>Short link:
+<a href="%[html:mysite]%[req:script]/%[ytid]"
+ >%[html:mysite]%[req:script]/%[ytid]</a>. You can share it
+ with friends and other people.</p>
+<p><a href="%[req:script]">Choose another video</a></p>
+
+%html:footer%