Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Title / Description? #27

Open
christianmagill opened this issue Jan 20, 2020 · 1 comment
Open

Title / Description? #27

christianmagill opened this issue Jan 20, 2020 · 1 comment

Comments

@christianmagill
Copy link

I see in the readme that the parser can obtain titles and descriptions, however I don't see anything related to this in the code? How can this be achieved?

@tamert
Copy link

tamert commented Jun 14, 2021

function getVimeoMeta($videoId)
{
    try {
        $hash = json_decode(file_get_contents("http://vimeo.com/api/v2/video/{$videoId}.json"));
        if (is_array($hash) and array_key_exists(0, $hash)) {
            return $hash[0];
        }
    } catch (\Exception $e) {
        return false;
    }
    return false;
}
function getYoutubeMeta($videoId)
{
    try {
        $url = 'https://www.googleapis.com/youtube/v3/videos?part=snippet&id=' . $videoId . '&key=yourcode';
        $curl = curl_init($url);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        $data = curl_exec($curl);
        curl_close($curl);
        $decoded = json_decode($data, true);
        foreach ($decoded['items'] as $items) {
            return $items['snippet'];
        }
    } catch (\Exception $e) {
        return false;
    }
    return false;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants