Repository navigation
Add Bilibili, Youku and NetEase Music adapters - #588
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #243
Adds adapters for three Chinese providers. None of them offers oEmbed, so the embed code is built from the URL alone, without extra requests. That way the player works even when the page itself cannot be read.
Adapters
Bilibili (
bilibili.com, andb23.tvshort links through their redirect)/video/BV...and/video/av...get an iframe tohttps://player.bilibili.com/player.html?bvid=<BV>(oraid=<n>), 640x360.出错啦!or视频去哪了呢?_哔哩哔哩_bilibili), title, description and image returnnullinstead of the error page values. A description that is an unfilled template (with{$0}orundefinedplaceholders) is discarded too.Youku (
youku.com)v.youku.com/v_show/id_<ID>.htmlgets an iframe tohttps://player.youku.com/embed/<ID>, 640x360.NetEase Music (
music.163.com)https://music.163.com/outchain/player?type=<2|1|0>&id=<id>&auto=0&height=66, 330x86.music.163.com/#/song?id=1keep the route after#, which is never sent to the server, so the homepage came back. They are now requested asmusic.163.com/song?id=1.authorNameis read from the description (由 X 演唱) when there is no other author./mv?id=and/#/mv?id=) are normalized the same way, but NetEase has no official embeddable MV player, so they get metadata only (nocode).To support the NetEase case there is a new static
Extractor::normalizeUri()hook.ExtractorFactory::normalizeUri()calls it for the matching adapter, andEmbed::get()/getMulti()use it before sending the request. The default implementation returns the URL unchanged.Testing
tests/ChineseProvidersTest.php: offline unit tests for the player URLs (bvid, aid, Youku id, NetEase song/album/playlist with and without#/), both Bilibili error pages and the unfilled description template, the requested NetEase URL (songs and MVs), MV without iframe and the author parsing.tests/PagesTest.php: new snapshots for one Bilibili video, one Youku video, one NetEase song and one NetEase album (#/URL).og:imageempty for this video). The NetEase album ID (18905) comes from the album link of the real song page (186016).Help wanted
Youku and NetEase are verified from a residential connection in Venezuela, but Bilibili only returns its error page from every network we tried, so we could not check its real metadata. If you are in a region where Bilibili works normally (or outside restricted networks in general), we would be very grateful if you could try a few real video URLs with this branch and tell us what you get for
title,imageandcode. Something like this is enough:Thank you!