Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Funkwhale #17923

Open
noplanman opened this issue Oct 19, 2018 · 6 comments
Open

Funkwhale #17923

noplanman opened this issue Oct 19, 2018 · 6 comments

Comments

@noplanman
Copy link

@noplanman noplanman commented Oct 19, 2018

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2018.10.05. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2018.10.05

Before submitting an issue make sure you have:

  • At least skimmed through the README, most notably the FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones
  • Checked that provided video/audio/playlist URLs (if any) are alive and playable in a browser

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

Purpose of this issue is a site support request

Funkwhale

  • Single audio: https://funkwhale.mastodon.host/library/tracks/4821
  • Album playlist: https://funkwhale.mastodon.host/library/albums/1120
  • Artist playlist: https://funkwhale.mastodon.host/library/artists/845

youtube-dl Falls back to generic and fails.


Description of your issue, suggested solution and other information

Related to #16301, as PeerTube is also a project from the Fediverse.

@EliotBerriot
Copy link

@EliotBerriot EliotBerriot commented Oct 23, 2018

Hi there, Funkwhale maintainer here!

The fact is that Funkwhale's web interface is a Single Page Application written in javascript. Thus, you cannot request the pages from the command line (or non-javascript web clients) and extract content from it.

However, you can extract the IDs in the URL and query the Funkwhale API directly to extract download urls.

Example: https://demo.funkwhale.audio/api/v1/albums/13/, which yield the following data:

{
  "id": 13,
  "mbid": null,
  "title": "The Slip",
  "release_date": null,
  "cover": {},
  "creation_date": "2018-10-21T00:11:22.683442Z",
  "is_playable": true,
  "artist": {
    "id": 12,
    "mbid": null,
    "name": "Nine Inch Nails",
    "creation_date": "2018-10-23T07:01:31.518110Z"
  },
  "tracks": [
    {
      "id": 70,
      "mbid": null,
      "title": "999,999",
      "album": 13,
      "artist": {
        "id": 12,
        "mbid": null,
        "name": "Nine Inch Nails",
        "creation_date": "2018-10-23T07:01:31.518110Z"
      },
      "creation_date": "2018-10-23T07:01:31.522321Z",
      "position": 1,
      "is_playable": true,
      "listen_url": "/api/v1/listen/968dc9ac-0bbf-4d3b-b4b5-2274f2448044/",
      "duration": 85
    },
    {
      "id": 71,
      "mbid": null,
      "title": "1,000,000",
      "album": 13,
      "artist": {
        "id": 12,
        "mbid": null,
        "name": "Nine Inch Nails",
        "creation_date": "2018-10-23T07:01:31.518110Z"
      },
      "creation_date": "2018-10-23T07:01:31.604775Z",
      "position": 2,
      "is_playable": true,
      "listen_url": "/api/v1/listen/4ec0c646-1de3-468b-9802-08a25b456c7d/",
      "duration": 236
    }
  ]
}

The important bit for each track is the listen_url which returns the audio file for playback.

We also have a /api/v1/tracks/ endpoint which returns track data dir. Example for a single track: https://demo.funkwhale.audio/api/v1/tracks/12/.

To download all the discography of an artist, you can filter albums using the artist ID: https://demo.funkwhale.audio/api/v1/albums/?artist=1

@noplanman
Copy link
Author

@noplanman noplanman commented Oct 23, 2018

@EliotBerriot Perfect to have such a simple and easy to use API!

How does one know (with just the plain HTML) that it is a Funkwhale instance?

@EliotBerriot
Copy link

@EliotBerriot EliotBerriot commented Oct 23, 2018

@noplanman I don't see an easy way right now, but we could easily add a meta tag in the Single Page App HTML, like <meta name="app" content="Funkwhale">, if it's something youtube-dl can use for detection?

@noplanman
Copy link
Author

@noplanman noplanman commented Oct 23, 2018

Something like that will probably be necessary, but as I'm no youbube-dl dev, there might be a different / better way.

Let's wait for a knowledgable person to read these lines... 😉

@EliotBerriot
Copy link

@EliotBerriot EliotBerriot commented Jan 17, 2019

As of version 0.18 (to be released next week) a Funkwhale server will output microdata on artist, album on track pages. Example for https://open.audio/library/tracks/40389:

<meta content="https://open.audio/library/tracks/40389" property="og:url" />
<meta content="Dead Inside" property="og:title" />
<meta content="music.song" property="og:type" />
<meta property="music:album:disc" />
<meta content="4" property="music:album:track" />
<meta content="https://open.audio/library/artists/93" property="music:musician" />
<meta content="https://open.audio/library/albums/6078" property="music:album" />
<meta content="https://open.audio/media/__sized__/albums/covers/2018/12/29/b28a4232e-9a64-45a2-93cf-046454d6bbb8-crop-c0-5__0-5-400x400-70.jpg" property="og:image" />
<meta content="https://open.audio/api/v1/listen/155c966f-e733-4b08-85c3-3b8b57f4c117/" property="og:audio" />
<link href="https://open.audio/api/v1/oembed/?format=json&amp;url=https%3A%2F%2Fopen.audio%2Flibrary%2Ftracks%2F40389" rel="alternate" type="application/json+oembed" />
<meta content="Open.Audio - Funkwhale" property="og:site_name" />
<meta content="Libre Music from the Commons" property="og:description" />

Especially, the og:audio tag will give you the audio file.

Using this data, we can probably easily support downloading individual files and full albums. I'd be happy to work on a generic youtube-dl extractor that supports music microformat (thus would be working not only with Funkwhale), but I'm not sure how to proceed.

@rugk
Copy link

@rugk rugk commented Jul 9, 2019

BTW, just wanting to say thanks to @EliotBerriot. Great, how you support the integration into youtube-dl here and even offer to write a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.