From 55df81e4fc9a5eafcf5ee0beaf77b6f30c41a138 Mon Sep 17 00:00:00 2001 From: Benedict de Silva Date: Mon, 16 Sep 2019 18:11:34 +0100 Subject: [PATCH] Add Vimeo as a provider Add Vimeo as a provider so as to take advantage of the oEmbed endpoint. Vimeo has started to ban IP blocks from popular providers (DigitalOcean, Vultr, Google Cloud) due to malicious behaviour from some IPs but subsequently affecting legitimate use cases. The ban results in 403 error codes when attempting to embed URLs using the standard "webpage" adapter, however oEmbed is unaffected. --- src/Adapters/Vimeo.php | 22 ++++++++++++++++++++++ src/Providers/OEmbed/Vimeo.php | 9 +++++++++ tests/VimeoTest.php | 20 ++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 src/Adapters/Vimeo.php create mode 100644 src/Providers/OEmbed/Vimeo.php create mode 100644 tests/VimeoTest.php diff --git a/src/Adapters/Vimeo.php b/src/Adapters/Vimeo.php new file mode 100644 index 00000000..511dadea --- /dev/null +++ b/src/Adapters/Vimeo.php @@ -0,0 +1,22 @@ +isValid([200, 403]) && $response->getUrl()->match([ + 'vimeo.com/*', + ]); + } +} diff --git a/src/Providers/OEmbed/Vimeo.php b/src/Providers/OEmbed/Vimeo.php new file mode 100644 index 00000000..dfe85145 --- /dev/null +++ b/src/Providers/OEmbed/Vimeo.php @@ -0,0 +1,9 @@ +assertEmbed( + 'https://vimeo.com/235352744', + [ + 'title' => 'Vimeo Live is here', + 'providerName' => 'Vimeo', + 'width' => 640, + 'height' => 360, + 'code' => '', + ] + ); + } +}