inspiredminds/contao-youtube-sync 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

inspiredminds/contao-youtube-sync

最新稳定版本:2.1.0

Composer 安装命令:

composer require inspiredminds/contao-youtube-sync

包简介

Contao extension to synchronize a contao news archive with a YouTube playlist.

README 文档

README

Contao YouTube Sync

This extension allows you to automatically import all videos of a YouTube playlist as news entries in Contao.

Configuration

First you need to obtain a Google API key.

  1. Go to console.developers.google.com and create a project, or use an existing one.
  2. Go to the API Library and search for YouTube Data API v3.
  3. Enable the YouTube Data API v3 for your project.
  4. Go to the Credentials of your project and choose Create Credentials » API key. You can also use an existing key.
  5. Copy the API key for later use.

After obtaining the API key it can be configured for the extension:

# config/config.yml
contao_youtube_sync:
    developer_key: <YOUR-API-KEY>

Once this extension is installed, you will have additional options in the settings of your Contao news archives:

YouTube synchronisation settings

Enable the synchronisation and set the YouTube playlist ID from which to import videos as news entries. You also need to define a default author for the synchronised entries and a target directory for the downloaded thumbnail images. Optionally you can define whether new entries should be published by default or not and if already synchronised entries should always be updated (this will not update the alias or author).

Synchronisation

Synchronisation can be triggered in three ways:

  • Cronjob: executed hourly.
  • Command: contao_youtube_sync:sync
  • Back end: in the article overview, use the YouTube sync link in the global operations.

Events

Whenever a YouTube video is imported as a news article (or whenever a news article is updated), the following event will be dispatched:

InspiredMinds\ContaoYouTubeSync\Event\NewsYouTubeSyncEvent

This event lets you retrieve the \Contao\NewsModel to be saved to the database, as well as the \Google\Service\YouTube\PlaylistItem instance of the YouTube video. It also allows you to discard the news article (or the changes added to it) by setting $event->setDiscard(true).

Templates

There will be two additional variables available within a news template:

  • $this->youtube_id: This will contain the video ID of the YouTube video, if the news article was imported from a YouTube playlist.
  • $this->youtube_data: This is an object containing the original data of the video from the Google YouTube API.

The extension also provides a basic news_youtube template, which can be used instead of the news_full template for the newsreader of YouTube videos. The template contains markup to show the YouTube video embedded in an iframe.

统计信息

  • 总下载量: 1.33k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2020-06-05