watch.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. {% set page_title = title %}
  2. {% extends "base.html" %}
  3. {% import "common_elements.html" as common_elements %}
  4. {% import "comments.html" as comments with context %}
  5. {% block style %}
  6. <link href="/youtube.com/static/message_box.css" rel="stylesheet">
  7. <link href="/youtube.com/static/watch.css" rel="stylesheet">
  8. {% if settings.use_video_player == 2 %}
  9. <!-- plyr -->
  10. <link href="/youtube.com/static/modules/plyr/plyr.css" rel="stylesheet">
  11. <link href="/youtube.com/static/modules/plyr/custom_plyr.css" rel="stylesheet">
  12. <!--/ plyr -->
  13. {% endif %}
  14. {% endblock style %}
  15. {% block main %}
  16. {% if playability_error %}
  17. <div class="playability-error">
  18. <span>{{ 'Error: ' + playability_error }}
  19. {% if invidious_reload_button %}
  20. <a href="{{ video_url }}&use_invidious=0"><br>
  21. Reload without invidious (for usage of new identity button).</a>
  22. {% endif %}
  23. </span>
  24. </div>
  25. {% elif (uni_sources.__len__() == 0 or live) and hls_formats.__len__() != 0 %}
  26. <div class="live-url-choices">
  27. <span>Copy a url into your video player:</span>
  28. <ol>
  29. {% for fmt in hls_formats %}
  30. <li class="url-choice"><div class="url-choice-label">{{ fmt['video_quality'] }}: </div><input class="url-choice-copy" value="{{ fmt['url'] }}" readonly onclick="this.select();"></li>
  31. {% endfor %}
  32. </ol>
  33. </div>
  34. {% else %}
  35. <figure class="sc-video">
  36. <video id="js-video-player" playsinline controls {{ 'autoplay' if settings.autoplay_videos }}>
  37. {% if uni_sources %}
  38. <source src="{{ uni_sources[uni_idx]['url'] }}" type="{{ uni_sources[uni_idx]['type'] }}" data-res="{{ uni_sources[uni_idx]['quality'] }}">
  39. {% endif %}
  40. {% for source in subtitle_sources %}
  41. {% if source['on'] %}
  42. <track label="{{ source['label'] }}" src="{{ source['url'] }}" kind="subtitles" srclang="{{ source['srclang'] }}" default>
  43. {% else %}
  44. <track label="{{ source['label'] }}" src="{{ source['url'] }}" kind="subtitles" srclang="{{ source['srclang'] }}">
  45. {% endif %}
  46. {% endfor %}
  47. </video>
  48. </figure>
  49. {% endif %}
  50. <div class="sc-info">
  51. <div class="video-info">
  52. <h1 class="v-title">{{ title }}</h1>
  53. <ul class="labels">
  54. {%- if unlisted -%}
  55. <li class="is-unlisted">Unlisted</li>
  56. {%- endif -%}
  57. {%- if age_restricted -%}
  58. <li class="age-restricted">Age-restricted</li>
  59. {%- endif -%}
  60. {%- if limited_state -%}
  61. <li>Limited state</li>
  62. {%- endif -%}
  63. {%- if live -%}
  64. <li>Live</li>
  65. {%- endif -%}
  66. </ul>
  67. <address class="v-uploaded">Uploaded by <a href="{{ uploader_channel_url }}">{{ uploader }}</a></address>
  68. <span class="v-views">{{ view_count }} views</span>
  69. <time class="v-published" datetime="{{ time_published_utc }}">Published on {{ time_published }}</time>
  70. <span class="v-likes-dislikes">{{ like_count }} likes</span>
  71. <div class="external-player-controls">
  72. <input class="speed" id="speed-control" type="text" title="Video speed">
  73. {% if settings.use_video_player != 2 %}
  74. <select id="quality-select" autocomplete="off">
  75. {% for src in uni_sources %}
  76. <option value='{"type": "uni", "index": {{ loop.index0 }}}' {{ 'selected' if loop.index0 == uni_idx and not using_pair_sources else '' }} >{{ src['quality_string'] }}</option>
  77. {% endfor %}
  78. {% for src_pair in pair_sources %}
  79. <option value='{"type": "pair", "index": {{ loop.index0}}}' {{ 'selected' if loop.index0 == pair_idx and using_pair_sources else '' }} >{{ src_pair['quality_string'] }}</option>
  80. {% endfor %}
  81. </select>
  82. {% endif %}
  83. </div>
  84. <input class="v-checkbox" name="video_info_list" value="{{ video_info }}" form="playlist-edit" type="checkbox">
  85. <span class="v-direct-link"><a href="https://youtu.be/{{ video_id }}" rel="noopener noreferrer" target="_blank">Direct Link</a></span>
  86. {% if settings.use_video_download != 0 %}
  87. <details class="v-download">
  88. <summary class="download-dropdown-label">Download</summary>
  89. <ul class="download-dropdown-content">
  90. {% for format in download_formats %}
  91. <li class="download-format">
  92. <a class="download-link" href="{{ format['url'] }}" download="{{ title }}.{{ format['ext'] }}">
  93. {{ format['ext'] }} {{ format['video_quality'] }} {{ format['audio_quality'] }} {{ format['file_size'] }} {{ format['codecs'] }}
  94. </a>
  95. </li>
  96. {% endfor %}
  97. {% for download in other_downloads %}
  98. <li class="download-format">
  99. <a href="{{ download['url'] }}" download>
  100. {{ download['ext'] }} {{ download['label'] }}
  101. </a>
  102. </li>
  103. {% endfor %}
  104. </ul>
  105. </details>
  106. {% else %}
  107. <span class="v-download"></span>
  108. {% endif %}
  109. <span class="v-description">{{ common_elements.text_runs(description)|escape|urlize|timestamps|safe }}</span>
  110. <div class="v-music-list">
  111. {% if music_list.__len__() != 0 %}
  112. <hr>
  113. <table>
  114. <caption>Music</caption>
  115. <tr>
  116. {% for attribute in music_attributes %}
  117. <th>{{ attribute }}</th>
  118. {% endfor %}
  119. </tr>
  120. {% for track in music_list %}
  121. <tr>
  122. {% for attribute in music_attributes %}
  123. {% if attribute.lower() == 'title' and track['url'] is not none %}
  124. <td><a href="{{ track['url'] }}">{{ track.get(attribute.lower(), '') }}</a></td>
  125. {% else %}
  126. <td>{{ track.get(attribute.lower(), '') }}</td>
  127. {% endif %}
  128. {% endfor %}
  129. </tr>
  130. {% endfor %}
  131. </table>
  132. {% endif %}
  133. </div>
  134. <details class="v-more-info">
  135. <summary>More info</summary>
  136. <div class="more-info-content">
  137. <p>Tor exit node: {{ ip_address }}</p>
  138. {% if invidious_used %}
  139. <p>Used Invidious as fallback.</p>
  140. {% endif %}
  141. <p class="allowed-countries">Allowed countries: {{ allowed_countries|join(', ') }}</p>
  142. {% if settings.use_sponsorblock_js %}
  143. <ul class="more-actions">
  144. <li><label><input type=checkbox id=skip_sponsors checked>skip sponsors</label> <span id=skip_n></span>
  145. </ul>
  146. {% endif %}
  147. </div>
  148. </details>
  149. </div>
  150. <div class="side-videos">
  151. <!-- playlist -->
  152. {% if playlist %}
  153. <div class="site-playlist">
  154. <div class="playlist-header">
  155. <a href="{{ playlist['url'] }}" title="{{ playlist['title'] }}"><h3>{{ playlist['title'] }}</h3></a>
  156. <ul class="playlist-metadata">
  157. <li><label for="playlist-autoplay-toggle">Autoplay: </label><input id="playlist-autoplay-toggle" type="checkbox" class="autoplay-toggle"></li>
  158. {% if playlist['current_index'] is none %}
  159. <li>[Error!]/{{ playlist['video_count'] }}</li>
  160. {% else %}
  161. <li>{{ playlist['current_index']+1 }}/{{ playlist['video_count'] }}</li>
  162. {% endif %}
  163. <li><a href="{{ playlist['author_url'] }}" title="{{ playlist['author'] }}">{{ playlist['author'] }}</a></li>
  164. </ul>
  165. </div>
  166. <nav class="playlist-videos">
  167. {% for info in playlist['items'] %}
  168. {# non-lazy load for 5 videos surrounding current video #}
  169. {# for non-js browsers or old such that IntersectionObserver doesn't work #}
  170. {# -10 is sentinel to not load anything if there's no current_index for some reason #}
  171. {% if (playlist.get('current_index', -10) - loop.index0)|abs is lt(5) %}
  172. {{ common_elements.item(info, include_badges=false, lazy_load=false) }}
  173. {% else %}
  174. {{ common_elements.item(info, include_badges=false, lazy_load=true) }}
  175. {% endif %}
  176. {% endfor %}
  177. </nav>
  178. </div>
  179. {% elif settings.related_videos_mode != 0 %}
  180. <div class="related-autoplay"><label for="related-autoplay-toggle">Autoplay: </label><input id="related-autoplay-toggle" type="checkbox" class="autoplay-toggle"></div>
  181. {% endif %}
  182. {% if subtitle_sources %}
  183. <details id="transcript-details">
  184. <summary>Transcript</summary>
  185. <div id="transcript-div">
  186. <select id="select-tt">
  187. {% for source in subtitle_sources %}
  188. <option>{{ source['label'] }}</option>
  189. {% endfor %}
  190. </select>
  191. <label for="transcript-use-table">Table view</label>
  192. <input id="transcript-use-table" type="checkbox">
  193. <table id="transcript-table"></table>
  194. </div>
  195. </details>
  196. {% endif %}
  197. {% if settings.related_videos_mode != 0 %}
  198. <details class="related-videos-outer" {{'open' if settings.related_videos_mode == 1 else ''}}>
  199. <summary>Related Videos</summary>
  200. <nav class="related-videos-inner">
  201. {% for info in related %}
  202. {{ common_elements.item(info, include_badges=false) }}
  203. {% endfor %}
  204. </nav>
  205. </details>
  206. {% endif %}
  207. </div>
  208. <!-- comments -->
  209. {% if settings.comments_mode != 0 %}
  210. {% if comments_disabled %}
  211. <div class="comments-area-outer comments-disabled">Comments disabled</div>
  212. {% else %}
  213. <details class="comments-area-outer" {{'open' if settings.comments_mode == 1 else ''}}>
  214. <summary>{{ comment_count|commatize }} comment{{'s' if comment_count != '1' else ''}}</summary>
  215. <div class="comments-area-inner comments-area">
  216. {% if comments_info %}
  217. {{ comments.video_comments(comments_info) }}
  218. {% endif %}
  219. </div>
  220. </details>
  221. {% endif %}
  222. {% endif %}
  223. </div>
  224. <script src="/youtube.com/static/js/av-merge.js"></script>
  225. <script src="/youtube.com/static/js/watch.js"></script>
  226. <script>
  227. // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
  228. let storyboard_url = {{ storyboard_url | tojson }};
  229. // @license-end
  230. </script>
  231. <script src="/youtube.com/static/js/common.js"></script>
  232. <script src="/youtube.com/static/js/transcript-table.js"></script>
  233. {% if settings.use_video_player == 2 %}
  234. <!-- plyr -->
  235. <script src="/youtube.com/static/modules/plyr/plyr.min.js"
  236. integrity="sha512-l6ZzdXpfMHRfifqaR79wbYCEWjLDMI9DnROvb+oLkKq6d7MGroGpMbI7HFpicvmAH/2aQO+vJhewq8rhysrImw=="
  237. crossorigin="anonymous"></script>
  238. <script src="/youtube.com/static/js/plyr-start.js"></script>
  239. <!-- /plyr -->
  240. {% elif settings.use_video_player == 1 %}
  241. <script src="/youtube.com/static/js/hotkeys.js"></script>
  242. {% endif %}
  243. {% if settings.use_comments_js %} <script src="/youtube.com/static/js/comments.js"></script> {% endif %}
  244. {% if settings.use_sponsorblock_js %} <script src="/youtube.com/static/js/sponsorblock.js"></script> {% endif %}
  245. {% endblock main %}