From 89e5761f8d9ae4221c4a97eca3c0fce3405a5bc4 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Sun, 8 Sep 2019 18:42:08 -0700 Subject: Extraction: Move playlist extraction to yt_data_extract --- youtube/templates/playlist.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'youtube/templates') diff --git a/youtube/templates/playlist.html b/youtube/templates/playlist.html index ab2640f..52c468e 100644 --- a/youtube/templates/playlist.html +++ b/youtube/templates/playlist.html @@ -55,7 +55,7 @@ {{ author }}
{{ views }}
-
{{ size }}
+
{{ size }} videos
{{ common_elements.text_runs(description) }}
-- cgit v1.2.3 From 9abb83fdbc05294f186daeefff8c85cfda06b7d2 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Fri, 27 Sep 2019 19:27:19 -0700 Subject: Extraction: Fix did_you_mean and showing_results_for --- youtube/templates/search.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'youtube/templates') diff --git a/youtube/templates/search.html b/youtube/templates/search.html index aef914a..8b803e7 100644 --- a/youtube/templates/search.html +++ b/youtube/templates/search.html @@ -29,10 +29,10 @@
Approximately {{ '{:,}'.format(estimated_results) }} results ({{ '{:,}'.format(estimated_pages) }} pages)
{% if corrections['type'] == 'showing_results_for' %} -
Showing results for {{ corrections['corrected_query']|safe }}
-
Search instead for {{ corrections['original_query'] }}
+
Showing results for {{ common_elements.text_runs(corrections['corrected_query_text']) }}
+
Search instead for {{ corrections['original_query_text'] }}
{% elif corrections['type'] == 'did_you_mean' %} -
Did you mean {{ corrections['corrected_query']|safe }}
+
Did you mean {{ common_elements.text_runs(corrections['corrected_query_text']) }}
{% endif %}
-- cgit v1.2.3 From 4c07546e7a5e5882abdda896009b744e947df1c4 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Thu, 17 Oct 2019 19:58:13 -0700 Subject: Extraction: Replace youtube-dl with custom-built watch page extraction --- youtube/templates/watch.html | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'youtube/templates') diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html index 14e953b..e97b638 100644 --- a/youtube/templates/watch.html +++ b/youtube/templates/watch.html @@ -187,8 +187,17 @@ .format-ext{ width: 60px; } - .format-res{ - width:90px; + .format-video-quality{ + width: 140px; + } + .format-audio-quality{ + width: 120px; + } + .format-file-size{ + width: 80px; + } + .format-codecs{ + width: 120px; } {% endblock style %} @@ -227,8 +236,10 @@
  1. {{ format['ext'] }}
  2. -
  3. {{ format['resolution'] }}
  4. -
  5. {{ format['note'] }}
  6. +
  7. {{ format['video_quality'] }}
  8. +
  9. {{ format['audio_quality'] }}
  10. +
  11. {{ format['file_size'] }}
  12. +
  13. {{ format['codecs'] }}
@@ -238,7 +249,7 @@ - {{ description }} + {{ common_elements.text_runs(description) }}
{% if music_list.__len__() != 0 %}
-- cgit v1.2.3 From 79d9a18f815a03498e21dd5769a2e70c7ae7afa5 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Fri, 22 Nov 2019 14:56:53 -0800 Subject: Extraction: return and display any errors preventing video playback --- youtube/templates/watch.html | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) (limited to 'youtube/templates') diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html index e97b638..da3b336 100644 --- a/youtube/templates/watch.html +++ b/youtube/templates/watch.html @@ -14,6 +14,19 @@ text-decoration: underline; } + .playability-error{ + height: 360px; + width: 640px; + grid-column: 2; + background-color: var(--video-background-color); + text-align:center; + } + .playability-error span{ + position: relative; + top: 50%; + transform: translate(-50%, -50%); + } + {% if theater_mode %} video{ grid-column: 1 / span 5; @@ -202,20 +215,24 @@ {% endblock style %} {% block main %} - + {% endif %}

{{ title }}

-- cgit v1.2.3 From ecc1ce42b84362cf73096f2e5e5a9ade1d4aa524 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Thu, 12 Dec 2019 22:13:37 -0800 Subject: Extraction: Display that video is age-restricted --- youtube/templates/watch.html | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'youtube/templates') diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html index da3b336..27150d4 100644 --- a/youtube/templates/watch.html +++ b/youtube/templates/watch.html @@ -74,12 +74,21 @@ grid-column: 1 / span 2; min-width: 0; } - .video-info > .is-unlisted{ - background-color: var(--interface-color); + .video-info > .labels{ justify-self:start; - padding-left:2px; - padding-right:2px; + list-style: none; + padding: 0px; + margin: 5px 0px; } + .video-info > .labels:empty{ + margin: 0px; + } + .labels > li{ + display: inline; + margin-right:5px; + background-color: var(--interface-color); + padding: 2px 5px + } .video-info > address{ grid-column: 1; grid-row: 3; @@ -236,9 +245,14 @@

{{ title }}

- {% if unlisted %} - Unlisted - {% endif %} +
    + {%- if unlisted -%} +
  • Unlisted
  • + {%- endif -%} + {%- if age_restricted -%} +
  • Age-restricted
  • + {%- endif -%} +
Uploaded by {{ uploader }}
{{ views }} views -- cgit v1.2.3 From 45a4ab5acedd2fd7531604d3e817e0742a036c4a Mon Sep 17 00:00:00 2001 From: James Taylor Date: Tue, 17 Dec 2019 20:58:15 -0800 Subject: Extraction: Detect limited state and fix false detection as unlisted --- youtube/templates/watch.html | 3 +++ 1 file changed, 3 insertions(+) (limited to 'youtube/templates') diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html index 27150d4..eaa3786 100644 --- a/youtube/templates/watch.html +++ b/youtube/templates/watch.html @@ -252,6 +252,9 @@ {%- if age_restricted -%}
  • Age-restricted
  • {%- endif -%} + {%- if limited_state -%} +
  • Limited state
  • + {%- endif -%}
    Uploaded by {{ uploader }}
    {{ views }} views -- cgit v1.2.3 From ee0a118a6c7ed0e371fed18dcdace1f18a3cabf6 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Tue, 17 Dec 2019 21:52:31 -0800 Subject: Extraction: Fix thumbnail and remove badges on related videos --- youtube/templates/common_elements.html | 6 ++++-- youtube/templates/watch.html | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'youtube/templates') diff --git a/youtube/templates/common_elements.html b/youtube/templates/common_elements.html index 67655b3..1a417ae 100644 --- a/youtube/templates/common_elements.html +++ b/youtube/templates/common_elements.html @@ -14,7 +14,7 @@ {%- endif -%} {% endmacro %} -{% macro item(info, description=false, horizontal=true, include_author=true) %} +{% macro item(info, description=false, horizontal=true, include_author=true, include_badges=true) %}
    {% if info['type'] == 'video' %} diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html index eaa3786..0ffa358 100644 --- a/youtube/templates/watch.html +++ b/youtube/templates/watch.html @@ -165,9 +165,13 @@ .related-videos-inner{ padding-top: 10px; display: grid; - grid-auto-rows: 94px; + grid-auto-rows: 90px; grid-row-gap: 10px; } + .thumbnail-box{ /* overides rule in shared.css */ + height: 90px !important; + width: 120px !important; + } /* Put related vids below videos when window is too small */ /* 1100px instead of 1080 because W3C is full of idiots who include scrollbar width */ @@ -311,7 +315,7 @@ Related Videos -- cgit v1.2.3 From 98777ee82561ae205f156a7f8497728aecfa080c Mon Sep 17 00:00:00 2001 From: James Taylor Date: Wed, 18 Dec 2019 19:39:16 -0800 Subject: Extraction: Rewrite item_extraction for better error handling and readability, rename extracted names for more consistency --- youtube/templates/comments.html | 4 +- youtube/templates/common_elements.html | 78 ++++++++++++++++++---------------- youtube/templates/playlist.html | 5 ++- youtube/templates/watch.html | 6 +-- 4 files changed, 49 insertions(+), 44 deletions(-) (limited to 'youtube/templates') diff --git a/youtube/templates/comments.html b/youtube/templates/comments.html index 20cde4e..396852a 100644 --- a/youtube/templates/comments.html +++ b/youtube/templates/comments.html @@ -12,11 +12,11 @@ {{ comment['author'] }} {{ common_elements.text_runs(comment['text']) }} - +
    {{ comment['view_replies_text'] }} {% if 'delete_url' is in comment %} diff --git a/youtube/templates/common_elements.html b/youtube/templates/common_elements.html index 1a417ae..4c776b6 100644 --- a/youtube/templates/common_elements.html +++ b/youtube/templates/common_elements.html @@ -9,55 +9,59 @@ {{ text_run["text"] }} {%- endif -%} {%- endfor -%} - {%- else -%} + {%- elif runs -%} {{ runs }} {%- endif -%} {% endmacro %} {% macro item(info, description=false, horizontal=true, include_author=true, include_badges=true) %}
    -
    - - - {% if info['type'] != 'channel' %} -
    - {{ info['size'] if info['type'] == 'playlist' else info['duration'] }} -
    - {% endif %} -
    + {% if info['error'] %} + {{ info['error'] }} + {% else %} +
    + + + {% if info['type'] != 'channel' %} +
    + {{ (info['video_count']|string + ' videos') if info['type'] == 'playlist' else info['duration'] }} +
    + {% endif %} +
    - + -
      - {% if info['type'] == 'channel' %} -
    • {{ info['subscriber_count'] }} subscribers
    • -
    • {{ info['size'] }} videos
    • - {% else %} - {% if include_author %} - {% if 'author_url' is in(info) %} -
    • By {{ info['author'] }}
    • - {% else %} -
    • {{ info['author'] }}
    • +
        + {% if info['type'] == 'channel' %} +
      • {{ info['approx_subscriber_count'] }} subscribers
      • +
      • {{ info['video_count'] }} videos
      • + {% else %} + {% if include_author %} + {% if info.get('author_url') %} +
      • By {{ info['author'] }}
      • + {% else %} +
      • {{ info['author'] }}
      • + {% endif %} + {% endif %} + {% if info.get('approx_view_count') %} +
      • {{ info['approx_view_count'] }} views
      • + {% endif %} + {% if info.get('time_published') %} +
      • {% endif %} {% endif %} - {% if 'views' is in(info) %} -
      • {{ info['views'] }}
      • - {% endif %} - {% if 'published' is in(info) %} -
      • - {% endif %} - {% endif %} -
      +
    - {% if description %} - {{ text_runs(info.get('description', '')) }} - {% endif %} - {% if include_badges %} - {{ info['badges']|join(' | ') }} + {% if description %} + {{ text_runs(info.get('description', '')) }} + {% endif %} + {% if include_badges %} + {{ info['badges']|join(' | ') }} + {% endif %} +
    + {% if info['type'] == 'video' %} + {% endif %} -
    - {% if info['type'] == 'video' %} - {% endif %}
    diff --git a/youtube/templates/playlist.html b/youtube/templates/playlist.html index 52c468e..ebd152b 100644 --- a/youtube/templates/playlist.html +++ b/youtube/templates/playlist.html @@ -54,8 +54,9 @@

    {{ title }}

    {{ author }}
    -
    {{ views }}
    -
    {{ size }} videos
    +
    {{ video_count|commatize }} videos
    +
    {{ view_count|commatize }} views
    +
    Last updated {{ time_published }}
    {{ common_elements.text_runs(description) }}
    diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html index 0ffa358..5bd2a25 100644 --- a/youtube/templates/watch.html +++ b/youtube/templates/watch.html @@ -261,11 +261,11 @@ {%- endif -%}
    Uploaded by {{ uploader }}
    - {{ views }} views + {{ view_count }} views - - + +
    Download
      -- cgit v1.2.3 From 02848a1a3213bb4ad872865768a7b97f663a24ed Mon Sep 17 00:00:00 2001 From: James Taylor Date: Thu, 19 Dec 2019 15:46:16 -0800 Subject: Extraction: Adjust related videos box to fit new time_published information well time_published will be put to the right of the view_count in related videos Author will now always be above the other stats, since it doesn't make a difference in the big search result boxes since the description snippet is always very short (However, it's important the author isn't inline with the other stats in related video boxes since those are so narrow and the author name can be very long) --- youtube/templates/common_elements.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'youtube/templates') diff --git a/youtube/templates/common_elements.html b/youtube/templates/common_elements.html index 4c776b6..7914c08 100644 --- a/youtube/templates/common_elements.html +++ b/youtube/templates/common_elements.html @@ -31,18 +31,18 @@ -
        + {% if include_author %} + {% if info.get('author_url') %} +
        By {{ info['author'] }}
        + {% else %} +
        {{ info['author'] }}
        + {% endif %} + {% endif %} +
          {% if info['type'] == 'channel' %}
        • {{ info['approx_subscriber_count'] }} subscribers
        • {{ info['video_count'] }} videos
        • {% else %} - {% if include_author %} - {% if info.get('author_url') %} -
        • By {{ info['author'] }}
        • - {% else %} -
        • {{ info['author'] }}
        • - {% endif %} - {% endif %} {% if info.get('approx_view_count') %}
        • {{ info['approx_view_count'] }} views
        • {% endif %} -- cgit v1.2.3