Skip to content

Commit

Permalink
feat: Added support for NeetoRecord provider.
Browse files Browse the repository at this point in the history
  • Loading branch information
mpratt committed Apr 12, 2024
1 parent 9bd050a commit 88acc8f
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/02-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 17 additions & 0 deletions doc/providers/NeetoRecord.md
Original file line number Diff line number Diff line change
@@ -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


56 changes: 56 additions & 0 deletions src/Embera/Provider/NeetoRecord.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/**
* NeetoRecord.php
*
* @package Embera
* @author Michael Pratt <yo@michael-pratt.com>
* @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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public function __construct(array $config = [])
'Nanoo',
'NaturalAtlas',
'NDLA',
'NeetoRecord',
'Nfb',
'NFTndx',
'Odysee',
Expand Down
35 changes: 35 additions & 0 deletions tests/Embera/Provider/NeetoRecordTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* NeetoRecordTest.php
*
* @package Embera
* @author Michael Pratt <yo@michael-pratt.com>
* @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]);
}
}

0 comments on commit 88acc8f

Please sign in to comment.