Skip to content

Provider Name wrongly capitalised for many websites #462

Open

Description

@diogogithub
$embed                     = new LibEmbed();
$info                      = $embed->get($url);
$metadata['title']         = $info->title;
$metadata['description']   = $info->description;
$metadata['author_name']   = $info->authorName;
$metadata['author_url']    = (string) $info->authorUrl;
$metadata['provider_name'] = $info->providerName;
$root_url                  = parse_url($url);
$root_url                  = "{$root_url['scheme']}://{$root_url['host']}";
$metadata['provider_url']  = (string) ($info->providerUrl != '' ? $info->providerUrl : $root_url);

With $url = 'https://eportugal.gov.pt/' the providerName is set as Eportugal instead of ePortugal. Even though "Eportugal" is not present anywhere in the website.
On the other hand, YouTube is returned as "YouTube". For many other websites it seems that the pattern of capitalising only the first letter and having the rest lower case is present.

Activity

  1. oscarotero commented on Dec 3, 2021

    @oscarotero
    Collaborator

    The capitalised domain name is the fallback when the provider name is not found in the code. You can see here the ProviderName detector code: https://github.com/oscarotero/Embed/blob/master/src/Detectors/ProviderName.php#L15

    • It search it in the provider_name key of oEmbed (if exists)
    • If not, searcht the og:site_name, publisher, etc meta tags
    • And if it's found, return the fallback.
  2. diogogithub commented on Dec 18, 2021

    @diogogithub
    Author

    Oh... Is there any setting to set the fallback to something like null representing the absence of value? Otherwise it can be complicated to distinguish between actual findings and this fallback...

  3. oscarotero commented on Dec 20, 2021

    @oscarotero
    Collaborator

    You can replace any detector, like this one with other with a different behavior. See this example:
    https://github.com/oscarotero/Embed#detectors

  4. Vitorinox commented on Nov 21, 2026

    @Vitorinox
    Collaborator

    PR #593 improves provider names: they can now come from application-name and apple-mobile-web-app-title, and the domain fallback drops the leading www. It is planned for 4.7.0. If you want to try it before the release:

    composer require embed/embed:dev-feat/providers-4.7.0
    

    This issue will stay open for anything that is still missing. Feedback is very welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions