oscarotero / Embed

Get info from any web service or page
MIT License
2.09k stars 310 forks source link

Call to undefined method Embed\Adapters\Youtube::getProvider() #179

Closed saleh-old closed 7 years ago

saleh-old commented 7 years ago

Hi

I used to(version 2) get the Embed URL (not code) using this code that was suggested by yourself:

$twitter = $info->getProvider('twittercards');
$embed = $twitter->bag->get('player');

But after upgrading to version 3 I get this exception error: Call to undefined method Embed\Adapters\Youtube::getProvider()

Any idea what should I do? thanks.

BTW, in case you're wondering what I'm trying to achieve here, this is an example. I want to get https://www.youtube.com/embed/BcDZS7iYNsA for the url http://youtube.com/watch?v=BcDZS7iYNsA#t=437

oscarotero commented 7 years ago

Hello. getProvider has been removed in order to simplify the api and avoid case issues with the provider name. But you can use this:

$twitter = $info->getProviders()['twittercards'];
$embed = $twitter->bag->get('player');
saleh-old commented 7 years ago

I tried this and now I get: Cannot access protected property Embed\Providers\TwitterCards::$bag

oscarotero commented 7 years ago

Sorry, the correct code:

$twitter->getBag()->get('player');
saleh-old commented 7 years ago

thanks man. One more question, has there been any validations for the inputs? or should I do them on my side?

oscarotero commented 7 years ago

The data returned is the received from the webpage, there's no validation.

saleh-old commented 7 years ago

Any idea how I can use the same validations that laravel uses on Reqeust $request? You to prevent injections cuz I am saving the data on the database.

oscarotero commented 7 years ago

Database injection is something that you should prevent in your database query, not here. This library just fetch the data from the webpage and returns it. Anyway, I'm open to ideas of how improve its security.