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

Twitch Clips not supported #28

Closed Kaz- closed 7 years ago

Kaz- commented 7 years ago

Hey :) ! I'm using your plugin on my fresh project, and I noticed they were no support for parsing Twitch Clips (new twitch feature for 30 sec video). A twitch clip url looks like this : https://clips.twitch.tv/pokelawls/VictoriousBearFailFish .

For now the parser considers this like a "stream".

I tried to add Twitch Clip support to your project so I could make a pull request but I'm just so terrible with RegExes, I couldn't get something working :( .

If I make all the other stuff could you give me a hand for the regex part ? We just need to detect if there is "clips." in front of twitch.tv , and then just get this string "pokelawls/VictoriousBearFailFish".

Zod- commented 7 years ago

This probably should be treated as a new format rather than being a video too, right?

Kaz- commented 7 years ago

Hmm shouldn't we add a mediaType 'clips' to the Twitch plugin ? Or should we add a new plugin "TwitchClips' ?

Zod- commented 7 years ago

Yeah I meant new mediaType and it should be in the same Plugin.

Zod- commented 7 years ago

I will work on it when I will find some time this weekend.

A tip tho: When working with regex it helps a lot when you have a visualizer.

I'm using Atom with the regex-railroad-diagram package that will display the regex when having a cursor on it. You can also use websites like Regexper or others.

Zod- commented 7 years ago

@Kaz- this should be it if you want to give it a try before I release it.

Kaz- commented 7 years ago

Just switched to Atom to practice regexes ! Thanks for the package :) !

I tried your commit and it seems to be working just great ! Nice work 👍 !