GithubHelp home page GithubHelp logo

Comments (5)

sylvainjule avatar sylvainjule commented on August 22, 2024

Would need more details about this:

  • Is the local config the same (i.e. PHP 8.3.6)?
  • What happens? Is an error message shown? Does the console log anything?
  • The field makes an API call to fetch the embed data, can you try dumping kirby()->site()->getEmbedData('https://vimeo.com/868805980') anywhere on your website, what does it return?

from kirby-embed.

mrflix avatar mrflix commented on August 22, 2024

I ran into the same issue, both on the production server as well as my local environment. Both running PHP 8.1.

Running kirby()->site()->getEmbedData('https://youtu.be/s2R6bD2trz4?si=9TAkSLNA3e62QeQU') produced an error status response with an empty error message.

I disabled the try {} catch {} in getEmbedData and got this error: Embed\Http\NetworkException (23) with an empty message.

Digging further into embeds CurlDispatcher` class I found out that "23" is an error code that somehow doesn't get resolved to its human message in the process:

An error occurred when writing received data to a local file, or an error was returned to libcurl from a write callback.

CurlDispatcher is providing its own CURLOPT_WRITEFUNCTION that writes to 'php://temp'. I logged the writing and it works. I looked upstream in https://github.com/oscarotero/Embed and found neither an error report nor a newer version where they might have fixed this.

I disabled the error exception and the results look fine so for now as my temporary fix I enhanced CurlDispatcher's exec method with a check to ignore error 23:

if (curl_errno($this->curl) && curl_errno($this->curl) != 23){
    $this->error(curl_error($this->curl), curl_errno($this->curl));
}

from kirby-embed.

mrflix avatar mrflix commented on August 22, 2024

I found a cleaner way to ignore the error – embed has a built in way:

In siteMethods.php you can change:

$embed = new Embed\Embed();

To:

use Embed\Http\Crawler;
use Embed\Http\CurlClient;

...


$client = new CurlClient();
$client->setSettings([
    'ignored_errors' => [23]
]);
$embed = new Embed\Embed(new Crawler($client));

from kirby-embed.

ImaCrea avatar ImaCrea commented on August 22, 2024

Sync also failed on my side when trying with any Youtube video. Here's what happen when I try with https://www.youtube.com/watch?v=ZXJWO2FQ16c for example :

Capture d’écran 2024-06-11 à 21 04 16

Env info
PHP: 8.3.6
K: 3.10.0.1
Plugin: 1.1.2

Debug

It happens only on the production machine hosted by Uberspace. Not on local env. 🤔 Also, it works with Vimeo link but not with a Youtube link.

Here's what I get when I try <?php dump(kirby()->site()->getEmbedData('https://www.youtube.com/watch?v=ZXJWO2FQ16c')); ?> on hosted server :

Capture d’écran 2024-06-11 à 21 13 13

I'll wait for an update, hopefully this feedback helps. Thanks for such a great plugin 🙏

from kirby-embed.

bnomei avatar bnomei commented on August 22, 2024

oscarotero/Embed#538

from kirby-embed.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.