Zod- / jsVideoUrlParser

A javascript parser to extract informations like provider, channel, id, start time from YouTube, Vimeo, Dailymotion, Twitch,... urls
MIT License
234 stars 73 forks source link

Support unlisted vimeo urls with parameters #116

Open JannikApm opened 10 months ago

JannikApm commented 10 months ago

Unlisted Vimeo links consist of the video ID and an additional hash: https://vimeo.com/[video_id]/[unlisted_hash]. More information about unlisted Vimeo links can be found here.

The problematic links I'm encountering are unlisted links with an additional URL parameter. Those are created when simply pressing the "share" button on an unlisted video's player.

Parsing the following link https://vimeo.com/12345678/abcdefg?share=copy returns

{
  "mediaType": "video",
  "params": {
    "share": "copy"
  },
  "id": "12345678",
  "provider": "vimeo"
}

While parsing https://vimeo.com/12345678/abcdefg returns

{
  "mediaType": "video",
  "params": {
    "hash": "abcdefg"
  },
  "id": "12345678",
  "provider": "vimeo"
}

Solution: URL param and hash should probably be merged so that both are kept.

Expected return for https://vimeo.com/12345678/abcdefg?share=copy

{
  "mediaType": "video",
  "params": {
    "hash": "abcdefg",
    "share": "copy"
  },
  "id": "12345678",
  "provider": "vimeo"
}