Skip to content

[ReadingTime] Do not estimate a reading time for YouTube videos - #580

Open
NopeCharon wants to merge 1 commit into
FreshRSS:mainfrom
NopeCharon:readingtime-youtube
Open

NopeCharon wants to merge 1 commit into
FreshRSS:mainfrom
NopeCharon:readingtime-youtube

Conversation

@NopeCharon

Copy link
Copy Markdown
Contributor

Summary

YouTube feeds do not provide the duration of their videos, only their description, so ReadingTime showed a meaningless estimate for them (usually <1 m). As suggested in the issue, the extension now simply ignores YouTube videos.

Changes:

  • no reading time is shown for articles linking to a YouTube video: youtube.com/watch, /shorts/ and /live/ (on www., m., music. or no subdomain) and youtu.be
  • the link is read from the data-link attribute of the article, with a fallback to the link of its title for FreshRSS versions older than 1.28 (which do not have data-link)
  • the reading time cell is kept but left empty, so the columns of the list of articles stay aligned
  • document it in the README (English and French), and bump the extension to 1.7.0

Other articles, including YouTube links that are not videos (e.g. a channel page), are unchanged.

Fixes #35

Validation

Ran the old and new readingtime.js in jsdom on a page mimicking the normal view (300 words per minute, words metric):

Article link Before After
https://www.youtube.com/watch?v=… <1 m (empty)
https://www.youtube.com/shorts/… <1 m (empty)
https://youtu.be/… <1 m (empty)
https://m.youtube.com/watch?v=… <1 m (empty)
https://youtube.com/live/… <1 m (empty)
https://www.youtube.com/watch?v=… without data-link (FreshRSS < 1.28) <1 m (empty)
https://example.net/post (900 words) 3 m 3 m
https://example.net/youtube.com/watch?v=x <1 m <1 m
https://www.youtube.com/channel/… (600 words) 2 m 2 m
https://notyoutube.com/watch?v=… (600 words) 2 m 2 m

Every article still gets exactly one reading time cell, and freshrss:load-more does not add duplicates.

eslint and markdownlint pass.

YouTube feeds do not provide the duration of their videos, only their
description. The reading time estimated from that description, usually
"<1 m", says nothing about how long it takes to watch the video and is
misleading next to the reading times of the other articles.

As agreed in the issue, no reading time is shown any longer for articles
linking to a YouTube video (youtube.com/watch, /shorts/ and /live/, on
www., m., music. or no subdomain, and youtu.be). The link is read from
the `data-link` attribute of the article, with a fallback to the link of
its title for FreshRSS versions older than 1.28. The cell of the reading
time is kept empty, so that the columns of the list of articles stay
aligned.

Document it in the README, and bump the extension to 1.7.0.

Fixes FreshRSS#35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ReadingTime] YouTube Support

1 participant