spicywebau / craft-embedded-assets

Manage YouTube videos, Instagram photos and more as first class assets in Craft CMS
MIT License
171 stars 36 forks source link

Could not retrieve embed information when adding a Google My Maps URL #126

Closed romainpoirier closed 1 year ago

romainpoirier commented 4 years ago

Description

I am not able to add Google My Maps URL as embed, and always got the Could not retrieve embed information error. This happens even the map privacy is set to Public (the most permissive permission).

Below is an example of stack trace (embed URL is now private for privacy purpose):

2020-04-07 14:44:16 [-][1][oc6fqgru9ldde653gudkke6sg1][error][yii\base\ErrorException:8] yii\base\ErrorException: Undefined offset: 1 in /www/vendor/embed/embed/src/Providers/Api/GoogleMaps.php:149
Stack trace:
#0 /www/vendor/craftcms/cms/src/web/ErrorHandler.php(80): yii\base\ErrorHandler->handleError(8, 'Undefined offse...', '/mnt/drbd_data/...', 149)
#1 /www/vendor/embed/embed/src/Providers/Api/GoogleMaps.php(149): craft\web\ErrorHandler->handleError(8, 'Undefined offse...', '/mnt/drbd_data/...', 149, Array)
#2 /www/vendor/embed/embed/src/Providers/Api/GoogleMaps.php(85): Embed\Providers\Api\GoogleMaps::getPosition('view', Object(Embed\Http\Url))
#3 /www/vendor/embed/embed/src/Adapters/Google.php(54): Embed\Providers\Api\GoogleMaps->getCode()
#4 /www/vendor/embed/embed/src/Adapters/Adapter.php(95): Embed\Adapters\Google->getCode()
#5 /www/vendor/embed/embed/src/Adapters/Adapter.php(109): Embed\Adapters\Adapter->__get('code')
#6 /www/vendor/embed/embed/src/Embed.php(93): Embed\Adapters\Adapter->__isset('code')
#7 /www/vendor/spicyweb/craft-embedded-assets/src/Service.php(95): Embed\Embed::create(Object(Embed\Http\Url), Array)
#8 /www/vendor/spicyweb/craft-embedded-assets/src/Service.php(53): spicyweb\embeddedassets\Service->_getDataFromAdapter('https://www.goo...')
#9 /www/vendor/spicyweb/craft-embedded-assets/src/Controller.php(199): spicyweb\embeddedassets\Service->requestUrl('https://www.goo...')
#10 [internal function]: spicyweb\embeddedassets\Controller->actionPreview()
#11 /www/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#12 /www/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#13 /www/vendor/craftcms/cms/src/web/Controller.php(187): yii\base\Controller->runAction('preview', Array)
#14 /www/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('preview', Array)
#15 /www/vendor/craftcms/cms/src/web/Application.php(299): yii\base\Module->runAction('embeddedassets/...', Array)
#16 /www/vendor/craftcms/cms/src/web/Application.php(565): craft\web\Application->runAction('embeddedassets/...', Array)
#17 /www/vendor/craftcms/cms/src/web/Application.php(278): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#18 /www/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#19 /www/htdocs/index.php(21): yii\base\Application->run()
#20 {main}
2020-04-07 14:44:16 [-][1][oc6fqgru9ldde653gudkke6sg1][info][application] $_GET = [
    'p' => 'admin/actions/embeddedassets/actions/preview'
    'showContent' => '1'
    'callback' => 'embeddedassetsxbvm08r95y6'
    'url' => 'https://www.google.com/maps/d/u/0/embed?mid=1IBT2XG6fJJwYkWYMCktfUWusAma3PD9t'
]

You can maybe debug with these URLs:

Steps to reproduce

  1. Go to admin/assets, click Embed, try to add a Google My Maps URL
  2. Get the Could not retrieve embed information error

Other information

romainpoirier commented 4 years ago

I can confirm the problem is still out there. The plugin failed to retrieve the embed based on the Google Maps URL or Share shorten URL (send as a link).

Workaround that I found (which is not very user-friendly) is to copy the href URL of the Google Maps iframe embed (Embed a map) instead of the Share shorten URL (send as a link).

ttempleton commented 1 year ago

Sorry for the late reply. I've been able to look at this and it unfortunately appears that the Embed library powering the plugin doesn't support Google My Maps. The appropriate workaround would be the one that you have described.