Giter Club home page Giter Club logo

gatsby-source-vimeo's Introduction

gatsby-source-vimeo

Source plugin for pulling data into Gatsby from Vimeo user videos endpoint.

Pre-requirements

You will need to register on Vimeo to get API keys to use this plugin: https://developer.vimeo.com/apps/new

Install

npm install --save gatsby-source-vimeo

How to use

// In your gatsby-config.js
plugins: [
  {
    resolve: `gatsby-source-vimeo`,
    options: {
      clientID: 'INSERT_YOUR_CLIENT_IDENTIFIER',
      clientSecret: 'INSERT_YOUR_CLIENT_SECRET',
      userID: 'INSERT_VIMEO_USER_ID_TO_FETCH_VIDEOS',
      searchQuery: 'INSERT_SEARCH_QUERY',               // Optional
      transformer(video) {                              // Optional
        video.newField = 'value';
        return video;
      },
    },
  },
];

Plugin Options

clientID

REQUIRED
Client identifier from Vimeo Developer dashboard

clientSecret

REQUIRED
Client secret from Vimeo Developer dashboard

userID

REQUIRED
User ID that you want to fetch videos from
(visit Vimeo profile and run window.vimeo.config.profile.app_config.user.id
on browser console to get the userID)

searchQuery

OPTIONAL
Keywords to filter videos to be fetched
(comma separated)

transformer

OPTIONAL
Transformer function to add or alter existing fields

Note

Remember you are only fetching video information, so this will provide you with Video titles, descriptions, embedded iframes and thumbnails.

gatsby-source-vimeo's People

Contributors

pedrouid avatar tresky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gatsby-source-vimeo's Issues

Vimeo API Returns Incomplete Results when `searchQuery` is included, but unspecified

The current implementation of the plugin uses the following query URL:

const _url = url || `https://api.vimeo.com/users/${userID}/videos?per_page=100&query=${_searchQuery}`;

This has the searchQuery always being included in the API query, but if it was unspecified in the plugin settings, it will be an empty string to the Vimeo API. This causes the Vimeo API to return incomplete results.

Will submit a PR that fixes this issue.

Feature request: Video tags

Hi, it will be pretty awesome to be able to also query video tags, that will open new possibilities for building gatsby sites with this source plugin.

Feature: Add the ability to pass a transformer function into the options

This feature request would add the ability to pass a transformer function into the config options for the plugin. This allows the user to add derived fields to the data that gets stored in GraphQL.

plugins: [
  {
    resolve: `gatsby-source-vimeo`,
    options: {
      clientID: 'INSERT_YOUR_CLIENT_IDENTIFIER',
      clientSecret: 'INSERT_YOUR_CLIENT_SECRET',
      userID: 'INSERT_VIMEO_USER_ID_TO_FETCH_VIDEOS',
      searchQuery: 'INSERT_SEARCH_QUERY [OPTIONAL]',
      transformer (video) {
        // Transform the video data [OPTIONAL]
        // i.e. Add extra fields or alter existing field
        video.newField = 'value'
        return video
      },
    },
  },
];

Will submit a PR.

source and transform nodesTypeError: Cannot read property 'match' of null

Hi Pedro

Getting following error. Googled but no solution yet. Thank you..

success open and validate gatsby-configs — 0.012 s
success load plugins — 0.472 s
success onPreInit — 5.735 s
success delete html and css files from previous builds — 0.043 s
info One or more of your plugins have changed since the last time you ran Gatsby. As
a precaution, we're deleting your site's cache to ensure there's not any stale
data
success initialize cache — 0.463 s
success copy gatsby files — 0.686 s
success onPreBootstrap — 0.008 s
⠂ source and transform nodesStarting to fetch data from Drupal
⠐ source and transform nodesTypeError: Cannot read property 'match' of null
    at parseVideos (/home/vide/node_modules/gatsby-source-vimeo/gatsby-node.js:50:6)
    at videos.forEach.video (/home/vide/node_modules/gatsby-source-vimeo/gatsby-node.js:117:40)
    at Array.forEach (<anonymous>)
    at Object.exports.sourceNodes (/home/vide/node_modules/gatsby-source-vimeo/gatsby-node.js:117:12)

config.js

{
      resolve: `gatsby-source-vimeo`,
      options: {
        clientID: `66d177164e9fcd0fe6f524fd397fb78c5e8`,
        clientSecret: `3eM1xdwse80YeYnYLqRPN4CMzyd/7bdvXnYrB0HOtlJbV36LQKOuCdsaREVx+YRgbTK6JNLa4d1A67vKk+1NXTCHIB5O
082uavu1PQ0t5isUlKNLyu3lY4Y`,
        userID: `92043621`,
        //searchQuery: 'INSERT_SEARCH_QUERY [OPTIONAL]',
        transformer (video) {
        // Transform the video data [OPTIONAL]
        // i.e. Add extra fields or alter existing field
          video.newField = 'value'
          return video
        }

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.