Comments (3)
Hi DoyleCC,
Thanks for reporting but I cant replicate the issue. It seems to be working just fine for me:
$embera = new Embera\Embera();
print_r($embera->getUrlInfo('http://www.dailymotion.com/video/x2fm26p_magic-flip-book_tech http://www.dailymotion.com/video/xzva95_jacob-jones-and-the-bigfoot-mystery-launch-trailer_videogames'));
Array
(
[http://www.dailymotion.com/video/x2fm26p_magic-flip-book_tech] => Array
(
[embera_using_fake] => 0
[type] => video
[version] => 1.0
[provider_name] => Dailymotion
[provider_url] => http://www.dailymotion.com
[title] => Magic Flip Book
[author_name] => Grand Illusions
[author_url] => http://www.dailymotion.com/grand-illusions
[width] => 480
[height] => 269
[html] => <iframe src="http://www.dailymotion.com/embed/video/x2fm26p" width="480" height="269" frameborder="0" allowfullscreen></iframe>
[thumbnail_url] => http://s1.dmcdn.net/Is5bU/x240-n0j.jpg
[thumbnail_width] => 427
[thumbnail_height] => 240
)
[http://www.dailymotion.com/video/xzva95_jacob-jones-and-the-bigfoot-mystery-launch-trailer_videogames] => Array
(
[embera_using_fake] => 0
[type] => video
[version] => 1.0
[provider_name] => Dailymotion
[provider_url] => http://www.dailymotion.com
[title] => Jacob Jones and the Bigfoot Mystery - Launch trailer
[author_name] => TheVaultvideojuegos
[author_url] => http://www.dailymotion.com/TheVaultvideojuegos
[width] => 480
[height] => 269
[html] => <iframe src="http://www.dailymotion.com/embed/video/xzva95" width="480" height="269" frameborder="0" allowfullscreen></iframe>
[thumbnail_url] => http://s1.dmcdn.net/BeIXa/x240-GcR.jpg
[thumbnail_width] => 427
[thumbnail_height] => 240
)
)
or
$embera = new Embera\Embera();
echo $embera->autoEmbed('http://www.dailymotion.com/video/x2fm26p_magic-flip-book_tech http://www.dailymotion.com/video/xzva95_jacob-jones-and-the-bigfoot-mystery-launch-trailer_videogames');
<iframe src="http://www.dailymotion.com/embed/video/x2fm26p" width="480" height="269" frameborder="0" allowfullscreen></iframe> <iframe src="http://www.dailymotion.com/embed/video/xzva95" width="480" height="269" frameborder="0" allowfullscreen></iframe>
Can you give me an example of a url that's not working for you?
from embera.
Sorry, it was my mistake.
My site has also still Dailymotion videos embedded from years ago, so I have links with the old and the new url's.
When I updated to 1.8.5 I had forgotten that I changed the regex in earlier versions to embed the old url's too.
Sorry again for bothering you.
from embera.
No problem DoyleCC!
If I may, let me suggest another approach to your problem. Instead of overwriting the core class, just write a new Oembed provider.
You want to convert the older urls dailymotion.com/username/video/id
to something like dailymotion.com/video/id_title
// Create a new class that extends the DailyMotion Provider
class CustomDailyMotion extends \Embera\Providers\DailyMotion
{
/** inline {@inheritdoc} */
protected function normalizeUrl()
{
parent::normalizeUrl();
// Support for older dailymotion links
if (preg_match('~dailymotion\.com/(?:[^/]+)/video/([^/]+)/?~i', $this->url, $matches)) {
$this->url = new \Embera\Url('http://www.dailymotion.com/video/' . $matches['1']);
}
}
}
$embera = new Embera\Embera();
// Register the new class to
$embera->addProvider('dailymotion.com', 'CustomDailyMotion');
$embera->addProvider('*.dailymotion.com', 'CustomDailyMotion');
print_r($embera->getUrlInfo(array(
'http://www.dailymotion.com/video/x2fm26p_magic-flip-book_tech',
// Normal url
'http://www.dailymotion.com/username/video/x2fm26p',
// will be converted to http://www.dailymotion.com/video/x2fm26p
'http://www.dailymotion.com/other_user_name_old_links/video/x2fm26p_magic-flip-book_tech',
// will be converted to http://www.dailymotion.com/video/x2fm26p_magic-flip-book_tech
)));
By converting the links, you get a compatible url with the new format. Embera takes care of the rest.
You don't need to modify the core class, so you don't have to think about doing changes right after updating.
Note that I'm registering the CustomClass
to dailymotion.com
and to *.dailymotion.com
. I did that because I visited the website again and found out that dailymotion has support for http://games.dailymotion.com and to live streaming.
I changed the DailyMotion
class in order to support those changes and I'll be pushing an update this weekend.
Im closing this issue for now!
from embera.
Related Issues (20)
- Animoto using a s3.amazonaws.com url. HOT 1
- Embedding playbuzz items HOT 1
- The New YouTube Desktop Design is not Supported. HOT 1
- Allow hidden vi HOT 1
- Silk defunct HOT 1
- Playbuzz implementation is incomplete HOT 1
- youtube rel=0 ? HOT 1
- How about dropping support php version prior to 7.2? HOT 3
- Allowing CKEditor5 code HOT 3
- Argument 2 passed to Embera\Http\OembedClient::__construct() must be an instance of Embera\Http\HttpClient, instance of Embera\Http\HttpClientCache given HOT 3
- Added Wordwall provider HOT 3
- Defer loading iframes and remove obsolete iframe's tags HOT 1
- Custom Provider Parameters HOT 6
- Broken/Unsupported Providers HOT 3
- Get video_id from Youtube URL HOT 3
- Facebook is problematic HOT 4
- Instagram oEmbed is deprecated HOT 1
- Support custom request headers HOT 2
- Vimeo private video links HOT 1
- Imgur not embedded? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from embera.