ActBlue.php
5 years ago
Adways.php
5 years ago
Altru.php
5 years ago
AmCharts.php
5 years ago
Animoto.php
5 years ago
AnnieMusic.php
5 years ago
Apester.php
5 years ago
Archivos.php
5 years ago
AudioClip.php
5 years ago
Audioboom.php
5 years ago
Audiomack.php
5 years ago
Avocode.php
5 years ago
Backtracks.php
5 years ago
BeautifulAI.php
5 years ago
BlackfireIO.php
5 years ago
Blogcast.php
5 years ago
Buttondown.php
5 years ago
Byzart.php
5 years ago
Ceros.php
5 years ago
ChartBlocks.php
5 years ago
Chirbit.php
5 years ago
CircuitLab.php
5 years ago
Clyp.php
5 years ago
CocoCorp.php
5 years ago
CodeHS.php
5 years ago
CodePen.php
5 years ago
CodeSandbox.php
5 years ago
Codepoints.php
5 years ago
Commaful.php
5 years ago
Coub.php
5 years ago
Cueup.php
5 years ago
DailyMotion.php
5 years ago
Datawrapper.php
5 years ago
Deseretnews.php
5 years ago
Deviantart.php
5 years ago
Didacte.php
5 years ago
Digiteka.php
5 years ago
DocDroid.php
5 years ago
DotSUB.php
5 years ago
EduMedia.php
5 years ago
Embedery.php
5 years ago
Ethfiddle.php
5 years ago
Eyrie.php
5 years ago
FITE.php
5 years ago
Facebook.php
4 years ago
Fader.php
5 years ago
FaithLifeTV.php
5 years ago
Fitapp.php
5 years ago
Flickr.php
5 years ago
Flourish.php
5 years ago
GeographCI.php
5 years ago
GeographDE.php
5 years ago
GeographUk.php
5 years ago
GetShow.php
5 years ago
GettyImages.php
5 years ago
Gfycat.php
5 years ago
Giphy.php
5 years ago
GloriaTV.php
5 years ago
Gyazo.php
5 years ago
Hearthis.php
5 years ago
HiHaHo.php
5 years ago
Huffduffer.php
5 years ago
IHeartRadio.php
5 years ago
Infogram.php
5 years ago
Infoveave.php
5 years ago
Injurymap.php
5 years ago
Inoreader.php
5 years ago
Instagram.php
5 years ago
Issuu.php
5 years ago
Jovian.php
5 years ago
KakaoTV.php
5 years ago
Kickstarter.php
5 years ago
Kidoju.php
5 years ago
KirimEmail.php
5 years ago
Kit.php
5 years ago
Kmdr.php
5 years ago
Knacki.php
5 years ago
LearningApps.php
5 years ago
LillePod.php
5 years ago
Livestream.php
5 years ago
Loom.php
5 years ago
Ludus.php
5 years ago
Lumiere.php
5 years ago
Matterport.php
5 years ago
MediaLab.php
5 years ago
MedienArchivKuenste.php
5 years ago
Meetup.php
4 years ago
MermaidInk.php
5 years ago
MessesInfo.php
5 years ago
MicrosoftStream.php
5 years ago
MixCloud.php
5 years ago
ModeloIO.php
5 years ago
MusicboxManiacs.php
5 years ago
Namchey.php
5 years ago
Nanoo.php
5 years ago
NaturalAtlas.php
5 years ago
Nfb.php
5 years ago
NoPaste.php
5 years ago
Omniscope.php
5 years ago
OnSizzle.php
5 years ago
OraTV.php
5 years ago
Orbitvu.php
5 years ago
Outplayed.php
5 years ago
OverflowIO.php
5 years ago
Oz.php
5 years ago
Padlet.php
5 years ago
Pastery.php
5 years ago
Pinpoll.php
5 years ago
Pixdor.php
5 years ago
Playbuzz.php
5 years ago
Podbean.php
5 years ago
PolariShare.php
5 years ago
Polldaddy.php
5 years ago
Portfolium.php
5 years ago
Posixion.php
5 years ago
ProviderAdapter.php
5 years ago
ProviderInterface.php
4 years ago
RadioPublic.php
5 years ago
Rcvis.php
5 years ago
Reddit.php
5 years ago
ReleaseWire.php
5 years ago
Replit.php
5 years ago
ReverbNation.php
5 years ago
Roomshare.php
5 years ago
RoosterTeeth.php
5 years ago
Rumble.php
5 years ago
RunKit.php
5 years ago
Saooti.php
5 years ago
SapoVideos.php
5 years ago
ScreenNine.php
5 years ago
Screencast.php
5 years ago
ScribbleMaps.php
5 years ago
Scribd.php
5 years ago
SendToNews.php
5 years ago
Shortnote.php
5 years ago
Shoudio.php
5 years ago
ShowTheWay.php
5 years ago
Simplecast.php
5 years ago
Sketchfab.php
5 years ago
Slideshare.php
5 years ago
SmashNotes.php
5 years ago
Smugmug.php
5 years ago
SocialExplorer.php
5 years ago
SongLink.php
5 years ago
SoundCloud.php
5 years ago
SpeakerDeck.php
5 years ago
Spotful.php
5 years ago
Spotify.php
5 years ago
Spreaker.php
5 years ago
StandfordDigitalRepository.php
5 years ago
Streamable.php
5 years ago
Subscribi.php
5 years ago
Sudomemo.php
5 years ago
Sutori.php
5 years ago
Sway.php
5 years ago
Ted.php
5 years ago
TheNewYorkTimes.php
5 years ago
Tickcounter.php
5 years ago
TikTok.php
5 years ago
Toornament.php
5 years ago
TourHero.php
5 years ago
Tumblr.php
5 years ago
Tuxx.php
5 years ago
Tvcf.php
5 years ago
TwentyThreeHq.php
5 years ago
Twitter.php
5 years ago
Typecast.php
5 years ago
Typlog.php
5 years ago
UniversitePantheonSorbonne.php
5 years ago
UniversityCambridgeMap.php
5 years ago
Uppy.php
5 years ago
UstreamTV.php
5 years ago
Ustudio.php
5 years ago
Veer.php
5 years ago
Verse.php
5 years ago
Vidyard.php
5 years ago
Vimeo.php
5 years ago
Viously.php
5 years ago
Vlipsy.php
5 years ago
Vlive.php
5 years ago
VoxSnap.php
5 years ago
WaveVideo.php
5 years ago
Wistia.php
5 years ago
Wizer.php
5 years ago
Wokwi.php
5 years ago
WolframCloud.php
5 years ago
Wordpress.php
5 years ago
Wordwall.php
5 years ago
Youtube.php
5 years ago
Zeplin.php
5 years ago
Zingsoft.php
5 years ago
ZnipeTV.php
5 years ago
Zoomable.php
5 years ago
iFixit.php
5 years ago
DailyMotion.php
87 lines
| 1 | <?php |
| 2 | /** |
| 3 | * DailyMotion.php |
| 4 | * |
| 5 | * @package Embera |
| 6 | * @author Michael Pratt <yo@michael-pratt.com> |
| 7 | * @link http://www.michael-pratt.com/ |
| 8 | * |
| 9 | * For the full copyright and license information, please view the LICENSE |
| 10 | * file that was distributed with this source code. |
| 11 | */ |
| 12 | |
| 13 | namespace Embera\Provider; |
| 14 | |
| 15 | use Embera\Url; |
| 16 | |
| 17 | /** |
| 18 | * dailymotion.com Provider |
| 19 | * @link https://dailymotion.com |
| 20 | * @link https://developer.dailymotion.com/player/#player-oembed |
| 21 | */ |
| 22 | class DailyMotion extends ProviderAdapter implements ProviderInterface |
| 23 | { |
| 24 | /** inline {@inheritdoc} */ |
| 25 | protected $endpoint = 'https://www.dailymotion.com/services/oembed?format=json'; |
| 26 | |
| 27 | /** inline {@inheritdoc} */ |
| 28 | protected $allowedParams = [ 'maxwidth', 'maxheight', 'callback', 'autoplay', 'syndication' ]; |
| 29 | |
| 30 | /** inline {@inheritdoc} */ |
| 31 | protected static $hosts = [ |
| 32 | '*.dailymotion.com', 'dai.ly' |
| 33 | ]; |
| 34 | |
| 35 | /** inline {@inheritdoc} */ |
| 36 | protected $httpsSupport = true; |
| 37 | |
| 38 | /** inline {@inheritdoc} */ |
| 39 | public function validateUrl(Url $url) |
| 40 | { |
| 41 | return (preg_match('~dailymotion\.com/video/(?:[^/]+)/?~i', (string) $url)); |
| 42 | } |
| 43 | |
| 44 | /** inline {@inheritdoc} */ |
| 45 | public function normalizeUrl(Url $url) |
| 46 | { |
| 47 | $url->convertToHttps(); |
| 48 | $url->addWWW(); |
| 49 | $url->removeLastSlash(); |
| 50 | $url->removeQueryString(); |
| 51 | |
| 52 | if (preg_match('~dailymotion\.com/(?:embed/)?(?:video|live)/([^/]+)/?~i', (string) $url, $matches)) { |
| 53 | $url->overwrite('https://www.dailymotion.com/video/' . $matches['1']); |
| 54 | } else if (preg_match('~dai\.ly/([^/]+)/?~i', (string) $url, $matches)) { |
| 55 | $url->overwrite('https://www.dailymotion.com/video/' . $matches['1']); |
| 56 | } |
| 57 | |
| 58 | return $url; |
| 59 | } |
| 60 | |
| 61 | /** inline {@inheritdoc} */ |
| 62 | public function getFakeResponse() |
| 63 | { |
| 64 | preg_match('~/video/([^/]+)~i', (string) $this->url, $matches); |
| 65 | @list($videoId, $videoTitle) = explode('_', $matches['1'], 2); |
| 66 | |
| 67 | $embedUrl = 'http://www.dailymotion.com/embed/video/' . $videoId; |
| 68 | |
| 69 | $attr = []; |
| 70 | $attr[] = 'frameborder="0"'; |
| 71 | $attr[] = 'width="{width}"'; |
| 72 | $attr[] = 'height="{height}"'; |
| 73 | $attr[] = 'src="' . $embedUrl . '"'; |
| 74 | $attr[] = 'allowfullscreen'; |
| 75 | $attr[] = 'allow="autoplay"'; |
| 76 | |
| 77 | return [ |
| 78 | 'type' => 'video', |
| 79 | 'provider_name' => 'Dailymotion', |
| 80 | 'provider_url' => 'http://www.dailymotion.com', |
| 81 | 'title' => (!empty($videoTitle) ? str_replace(array('-', '_'), ' ', $videoTitle) : 'Unknown Title'), |
| 82 | 'html' => '<iframe ' . implode(' ', $attr). '></iframe>', |
| 83 | ]; |
| 84 | } |
| 85 | |
| 86 | } |
| 87 |