diff --git a/backend/src/schema/resolvers/embeds/findProvider.spec.js b/backend/src/schema/resolvers/embeds/findProvider.spec.js index cc8cdcb70..963b255ab 100644 --- a/backend/src/schema/resolvers/embeds/findProvider.spec.js +++ b/backend/src/schema/resolvers/embeds/findProvider.spec.js @@ -8,14 +8,102 @@ describe('Vimeo', () => { }) }) -describe('RiffReporter', () => { - it('matches `https://www.riffreporter.de/flugbegleiter-koralle/`', () => { - expect(findProvider('https://www.riffreporter.de/flugbegleiter-koralle/')).toEqual( - 'https://www.riffreporter.de/service/oembed', +describe('D.Tube', () => { + it('matches `https://d.tube/v/alexshumsky/q4D-hIOjknY`', () => { + expect(findProvider('https://d.tube/v/alexshumsky/q4D-hIOjknY')).toEqual( + 'https://api.d.tube/oembed', ) }) }) +describe('GIPHY', () => { + it('matches `https://giphy.com/gifs/KRB0DCpSFQeT6/html5`', () => { + expect(findProvider('https://giphy.com/gifs/KRB0DCpSFQeT6/html5')).toEqual( + 'https://giphy.com/services/oembed', + ) + }) +}) + +describe('Flicker', () => { + it('matches `https://flic.kr/p/VT2HCQ`', () => { + expect(findProvider('https://flic.kr/p/VT2HCQ')).toEqual( + 'https://www.flickr.com/services/oembed/', + ) + }) +}) + +describe('Codepen', () => { + it('matches `https://codepen.io/goodkatz/pen/LYPGxQz`', () => { + expect(findProvider('https://codepen.io/goodkatz/pen/LYPGxQz')).toEqual( + 'http://codepen.io/api/oembed', + ) + }) +}) + +describe('Meetup', () => { + it('matches `https://www.meetup.com/de-DE/spielego/events/ctdplqyzmbfc/`', () => { + expect(findProvider('https://www.meetup.com/de-DE/spielego/events/ctdplqyzmbfc/')).toEqual( + 'https://api.meetup.com/oembed', + ) + }) +}) + +describe('Mixcloud', () => { + it('matches `https://www.mixcloud.com/diffrent/giraffecast025/`', () => { + expect(findProvider('https://www.mixcloud.com/diffrent/giraffecast025/')).toEqual( + 'https://www.mixcloud.com/oembed/', + ) + }) +}) + +describe('Reddit', () => { + it('matches `https://www.reddit.com/r/LivestreamFail/comments/d6a2ge/greek_banned/`', () => { + expect( + findProvider('https://www.reddit.com/r/LivestreamFail/comments/d6a2ge/greek_banned/'), + ).toEqual('https://www.reddit.com/oembed') + }) +}) + +describe('Slideshare', () => { + it('matches `https://www.slideshare.net/ma6/lets-build-an-airport-how-to-estimate-large-scale-projects`', () => { + expect( + findProvider( + 'https://www.slideshare.net/ma6/lets-build-an-airport-how-to-estimate-large-scale-projects', + ), + ).toEqual('http://www.slideshare.net/api/oembed/2') + }) +}) + +describe('Soundcloud', () => { + it('matches `https://soundcloud.com/placid-records/zangenhand-live-altes-wettb-ro`', () => { + expect( + findProvider('https://soundcloud.com/placid-records/zangenhand-live-altes-wettb-ro'), + ).toEqual('https://soundcloud.com/oembed') + }) +}) + +describe('Twitch', () => { + it('matches `https://www.twitch.tv/gtimetv`', () => { + expect(findProvider('https://www.twitch.tv/gtimetv')).toEqual('https://api.twitch.tv/v4/oembed') + }) +}) + +describe('Twitter', () => { + it('matches `https://twitter.com/kenfm/status/1168682881524232194`', () => { + expect(findProvider('https://twitter.com/kenfm/status/1168682881524232194')).toEqual( + 'https://publish.twitter.com/oembed', + ) + }) +}) + +describe('Facebook', () => { + it('matches `https://www.facebook.com/FacebookDeutschland/videos/1960353927603280/`', () => { + expect( + findProvider('https://www.facebook.com/FacebookDeutschland/videos/1960353927603280/'), + ).toEqual('https://www.facebook.com/plugins/post/oembed.json') + }) +}) + describe('Youtube', () => { it('matches `https://www.youtube.com/watch?v=qkdXAtO40Fo`', () => { expect(findProvider('https://www.youtube.com/watch?v=qkdXAtO40Fo')).toEqual( diff --git a/backend/src/schema/resolvers/embeds/providers.json b/backend/src/schema/resolvers/embeds/providers.json index 4dc13bb62..ef9f04bff 100644 --- a/backend/src/schema/resolvers/embeds/providers.json +++ b/backend/src/schema/resolvers/embeds/providers.json @@ -77,6 +77,21 @@ } ] }, + { + "provider_name": "GIPHY", + "provider_url": "https:\/\/giphy.com", + "endpoints": [ + { + "schemes": [ + "https:\/\/giphy.com\/gifs\/*", + "http:\/\/gph.is\/*", + "https:\/\/media.giphy.com\/media\/*\/giphy.gif" + ], + "url": "https:\/\/giphy.com\/services\/oembed", + "discovery": true + } + ] + }, { "provider_name": "Instagram", "provider_url": "https:\/\/instagram.com", @@ -143,18 +158,6 @@ } ] }, - { - "provider_name": "Screenr", - "provider_url": "http:\/\/www.screenr.com\/", - "endpoints": [ - { - "schemes": [ - "http:\/\/www.screenr.com\/*\/" - ], - "url": "http:\/\/www.screenr.com\/api\/oembed.{format}" - } - ] - }, { "provider_name": "SlideShare", "provider_url": "http:\/\/www.slideshare.net\/", @@ -185,19 +188,6 @@ } ] }, - { - "provider_name": "Spotify", - "provider_url": "https:\/\/spotify.com\/", - "endpoints": [ - { - "schemes": [ - "https:\/\/*.spotify.com\/*", - "spotify:*" - ], - "url": "https:\/\/embed.spotify.com\/oembed\/" - } - ] - }, { "provider_name": "Twitch", "provider_url": "https:\/\/www.twitch.tv",