diff --git a/doc/02-providers.md b/doc/02-providers.md index 74eb8dc..85762b4 100644 --- a/doc/02-providers.md +++ b/doc/02-providers.md @@ -131,6 +131,7 @@ I try to support all the providers listed on [oembed.com](https://oembed.com). - [Nanoo](providers/Nanoo.md) - [NaturalAtlas](providers/NaturalAtlas.md) - [NDLA](providers/NDLA.md) +- [NeetoRecord](providers/NeetoRecord.md) - [Nfb](providers/Nfb.md) - [NFTndx](providers/NFTndx.md) - [Odysee](providers/Odysee.md) diff --git a/doc/providers/NeetoRecord.md b/doc/providers/NeetoRecord.md new file mode 100644 index 0000000..0e8d2b5 --- /dev/null +++ b/doc/providers/NeetoRecord.md @@ -0,0 +1,17 @@ +# [NeetoRecord](https://*.neetorecord.com) + +NeetoRecord Provider + +## Implementation Details + +- Provider +Name: NeetoRecord +- Documentation: NONE +- HTTPS support: YES +- Fake Response: NO +- Oembed Params: maxwidth , maxheight +- Supported Hosts: *.neetorecord.com +- Responsive response: NO +- Collections: DefaultProviderCollection + + diff --git a/src/Embera/Provider/NeetoRecord.php b/src/Embera/Provider/NeetoRecord.php new file mode 100644 index 0000000..ed68f68 --- /dev/null +++ b/src/Embera/Provider/NeetoRecord.php @@ -0,0 +1,56 @@ + + * @link http://www.michael-pratt.com/ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Embera\Provider; + +use Embera\Url; + +/** + * NeetoRecord Provider + * + * @link https://*.neetorecord.com + */ +class NeetoRecord extends ProviderAdapter implements ProviderInterface +{ + /** inline {@inheritdoc} */ + protected $endpoint = 'https://api.neetorecord.com/api/v1/oembed'; + + /** inline {@inheritdoc} */ + protected static $hosts = [ + '*.neetorecord.com' + ]; + + /** inline {@inheritdoc} */ + protected $allowedParams = [ 'maxwidth', 'maxheight' ]; + + /** inline {@inheritdoc} */ + protected $httpsSupport = true; + + /** inline {@inheritdoc} */ + protected $responsiveSupport = false; + + /** inline {@inheritdoc} */ + public function validateUrl(Url $url) + { + return (bool) (preg_match('~neetorecord\.com/watch/([^/]+)~i', (string) $url)); + } + + /** inline {@inheritdoc} */ + public function normalizeUrl(Url $url) + { + $url->convertToHttps(); + $url->removeQueryString(); + $url->removeLastSlash(); + + return $url; + } +} diff --git a/src/Embera/ProviderCollection/DefaultProviderCollection.php b/src/Embera/ProviderCollection/DefaultProviderCollection.php index 1c68c06..cab8166 100755 --- a/src/Embera/ProviderCollection/DefaultProviderCollection.php +++ b/src/Embera/ProviderCollection/DefaultProviderCollection.php @@ -151,6 +151,7 @@ public function __construct(array $config = []) 'Nanoo', 'NaturalAtlas', 'NDLA', + 'NeetoRecord', 'Nfb', 'NFTndx', 'Odysee', diff --git a/tests/Embera/Provider/NeetoRecordTest.php b/tests/Embera/Provider/NeetoRecordTest.php new file mode 100644 index 0000000..21b2c9c --- /dev/null +++ b/tests/Embera/Provider/NeetoRecordTest.php @@ -0,0 +1,35 @@ + + * @link http://www.michael-pratt.com/ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Embera\Provider; + +use Embera\ProviderTester; + +/** + * Test the NeetoRecord Provider + */ +final class NeetoRecordTest extends ProviderTester +{ + protected $tasks = [ + 'valid_urls' => [ + 'https://spinkart.neetorecord.com/watch/ade154fb-bff3-4347-b2fa-be77db58e792', + ], + 'invalid_urls' => [ + 'https://spinkart.neetorecord.com', + ], + ]; + + public function testProvider() + { + $this->validateProvider('NeetoRecord', [ 'width' => 480, 'height' => 270]); + } +}