- PHP 96.7%
- CSS 3.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| static | ||
| diagnose.php | ||
| extension.php | ||
| metadata.json | ||
| README.md | ||
BBC Video for FreshRSS
Makes videos in BBC News articles playable inside FreshRSS.
BBC article pages build their video player in JavaScript, so a scraped article only contains an empty placeholder and a "To play this video you need to enable JavaScript in your browser" message. This extension swaps that placeholder for BBC's own embeddable player.
How it works
When an entry from bbc.co.uk or bbc.com is added or updated, the extension:
- fetches the article page,
- reads the video details from the page's
window.__INITIAL_DATA__JSON, - replaces each video placeholder in the entry with an iframe of BBC's
embed player (
https://www.bbc.com/ws/av-embeds/articles/<asset>/<vpid>/en-GB/).
It handles:
- News articles (
/news/articles/…): every clip BBC marks as embeddable, matched to its placeholder in page order. - Video pages (
/news/videos/…): the page's own clip only, not the "Explore more" sidebar. - Portrait clips: shown phone-shaped and centred; landscape clips are full width at 16:9.
BBC often edits articles after publishing. When that happens, FreshRSS fetches the article again and the empty placeholder comes back, so the extension fills it in again. It only makes the extra request if there is a placeholder to fill.
Player sizing (static/style.css) and the Content-Security-Policy entry for
BBC's player frames are included, so no custom CSS or server changes are needed.
Installation
- Copy the
xExtension-BbcVideofolder into FreshRSS'sextensions/folder (/var/www/FreshRSS/extensions/in the official Docker image). - As an admin, enable BBC Video under Settings → Extensions.
Only entries fetched after enabling it are changed.
Requirements
- FreshRSS with full-content retrieval set up for your BBC feeds (see below), so the placeholder is in the stored entry. Without a placeholder the player is added at the top.
- FreshRSS 1.27.1 or later to keep the video when BBC updates an article. Older versions work for new articles, but an updated article loses its video.
- PHP with the
curlanddomextensions (both are in the official image).
Article Retrieval setup
Here is my setup:
- Article CSS selector on original website:
main - CSS selector of the elements to remove
aside,[data-component~="ad-slot"],[data-testid~="ad-unit"],[data-testid="byline"],[data-component="image-block"] img~span,[data-block="byline"],[data-block="metadata"],[data-block="promoList"],[data-block="eventPromo"],.visually-hidden,[data-block="headline"],[data-block="topicList"],img[src*="grey-placeholder"],[class*="StyledFigureCopyright"],[data-block="headline"],header [class*="HeaderBox"]
Troubleshooting
Failures are written to the FreshRSS log with the prefix BbcVideo:. Normal
progress is logged at notice level, which production installs hide.
To test fetching and parsing on your server:
docker exec freshrss php extensions/xExtension-BbcVideo/diagnose.php "https://www.bbc.co.uk/news/articles/<id>"
Caveats
- It relies on the structure of BBC's page data, which may change without notice.
- BBC video pages flag their clips as not embeddable; the embed player plays them at the moment, but BBC could start enforcing that.
- Some clips may be geo-restricted outside the UK.
- One extra request to BBC per new BBC entry, and per update of an entry with a video.
- FreshRSS's Reload articles action (in the feed settings) runs no extension hook, so articles it re-fetches lose their video until BBC next updates them.