npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-youtube-api-factory

v0.6.2

Published

angularjs factory for youtube json rest api requests

Downloads

716

Readme

angular-youtube-api-factory is an angularjs module with a youtube api factory.

npm version Bower version

Author: Jonathan Hornung (JohnnyTheTank)

Usage

  1. Install via either bower, npm or downloaded files:
    1. bower install --save angular-youtube-api-factory
    2. npm install --save angular-youtube-api-factory
    3. download angular-youtube-api-factory.zip
  2. Add jtt_youtube to your application's module dependencies.
  3. Include dependencies in your HTML.
    1. When using bower:
    <script src="bower_components/angular-youtube-api-factory/dist/angular-youtube-api-factory.min.js"></script>
    1. When using npm:
    <script src="node_modules/angular-youtube-api-factory/dist/angular-youtube-api-factory.min.js"></script>
    1. when using downloaded files
    <script src="angular-youtube-api-factory.min.js"></script>
  4. Use youtubeFactory via dependency injection

factory methods

getVideo

//docs: https://developers.google.com/youtube/v3/docs/videos/list
youtubeFactory.getVideoById({
    videoId: "<VIDEO_ID>",
    part: "<YOUR_PART>", // (optional) default: 'id,snippet,contentDetails,statistics'
    key: "<YOUR_API_KEY>",
}).then(function (_data) {
    //on success
}).catch(function (_data) {
    //on error
});

getVideos

//docs: https://developers.google.com/youtube/v3/docs/channels/list
youtubeFactory.getVideosFromChannelById({
    channelId: "<CHANNEL_ID>", // converter: http://johnnythetank.github.io/youtube-channel-name-converter/
    q: "<SEARCH_STRING>", // (optional) search string
    location: "<SEARCH_LOCATION>", // (optional) The parameter value is a string that specifies latitude/longitude coordinates e.g. '37.42307,-122.08427'.
    locationRadius: "<LOCATION_RADIUS>", // (optional) valid values e.g. '1500m', '5km', '10000ft', and '0.75mi' | default: '5000m'
    order: "<ORDER_TYPE>", // (optional) valid values: 'date', 'rating', 'relevance', 'title', 'videoCount', 'viewCount' | default: 'date'
    maxResults: "<MAX_RESULTS>", // (optional) valid values: 0-50 | default: 5
    publishedAfter: "<PUBLISHED_AFTER>", // (optional) RFC 3339 formatted date-time value (1970-01-01T00:00:00Z)
    publishedBefore: "<PUBLISHED_AFTER>", // (optional) RFC 3339 formatted date-time value (1970-01-01T00:00:00Z)
    regionCode: "<REGION_CODE>", // (optional) ISO 3166-1 alpha-2 country code
    relevanceLanguage: "<RELEVANCE_LANGUAGE>", // (optional) ISO 639-1 two-letter language code
    safeSearch: "<SAFE_SEARCH>", // (optional) valid values: 'moderate','none','strict' | defaut: 'moderate'
    maxResults: "<MAX_RESULTS>", // (optional) valid values: 0-50 | default: 5
    videoEmbeddable: "<VIDEO_EMBEDDABLE>", // (optional) valid values: 'true', 'any' | default: 'true'
    videoLicense: "<VIDEO_LICENSE>", // (optional) valid values: 'any','creativeCommon','youtube'
    videoSyndicated: "<VIDEO_SYNDICATED>", // (optional) restrict a search to only videos that can be played outside youtube.com. valid values: 'any','true' | default: 'any'
    fields: "<FIELDS>", // (optional) Selector specifying which fields to include in a partial response
    nextPageToken: "<NEXT__PAGE_TOKEN>", // (optional) either `nextPageToken` or `prevPageToken`
    prevPageToken: "<PREV__PAGE_TOKEN>", // (optional) either `nextPageToken` or `prevPageToken`
    part: "<PART>", // (optional) default: 'id,snippet'
    key: "<YOUR_API_KEY>",
}).then(function (_data) {
    //on success
}).catch(function (_data) {
    //on error
});
//docs: https://developers.google.com/youtube/v3/docs/search/list
youtubeFactory.getVideosFromSearchByParams({
    q: "<SEARCH_STRING>", // (optional) search string
    location: "<SEARCH_LOCATION>", // (optional) The parameter value is a string that specifies latitude/longitude coordinates e.g. '37.42307,-122.08427'.
    locationRadius: "<LOCATION_RADIUS>", // (optional) valid values e.g. '1500m', '5km', '10000ft', and '0.75mi' | default: '5000m'
    order: "<ORDER_TYPE>", // (optional) valid values: 'date', 'rating', 'relevance', 'title', 'videoCount', 'viewCount' | default: 'date'
    maxResults: "<MAX_RESULTS>", // (optional) valid values: 0-50 | default: 5
    publishedAfter: "<PUBLISHED_AFTER>", // (optional) RFC 3339 formatted date-time value (1970-01-01T00:00:00Z)
    publishedBefore: "<PUBLISHED_AFTER>", // (optional) RFC 3339 formatted date-time value (1970-01-01T00:00:00Z)
    regionCode: "<REGION_CODE>", // (optional) ISO 3166-1 alpha-2 country code
    relevanceLanguage: "<RELEVANCE_LANGUAGE>", // (optional) ISO 639-1 two-letter language code
    safeSearch: "<SAFE_SEARCH>", // (optional) valid values: 'moderate','none','strict' | defaut: 'moderate'
    maxResults: "<MAX_RESULTS>", // (optional) valid values: 0-50 | default: 5
    videoEmbeddable: "<VIDEO_EMBEDDABLE>", // (optional) valid values: 'true', 'any' | default: 'true'
    videoLicense: "<VIDEO_LICENSE>", // (optional) valid values: 'any','creativeCommon','youtube'
    videoSyndicated: "<VIDEO_SYNDICATED>", // (optional) restrict a search to only videos that can be played outside youtube.com. valid values: 'any','true' | default: 'any'
    fields: "<FIELDS>", // (optional) Selector specifying which fields to include in a partial response
    nextPageToken: "<NEXT__PAGE_TOKEN>", // (optional) either `nextPageToken` or `prevPageToken`
    prevPageToken: "<PREV__PAGE_TOKEN>", // (optional) either `nextPageToken` or `prevPageToken`
    part: "<PART>", // (optional) default: 'id,snippet'
    key: "<YOUR_API_KEY>",
}).then(function (_data) {
    //on success
}).catch(function (_data) {
    //on error
});
//docs: https://developers.google.com/youtube/v3/docs/playlists/list
youtubeFactory.getVideosFromPlaylistById({
    playlistId: "<PLAYLIST_ID>",
    maxResults: "<MAX_RESULTS>", // (optional) valid values: 0-50 // default: 5
    nextPageToken: "<NEXT__PAGE_TOKEN>", // (optional) either `nextPageToken` or `prevPageToken`
    prevPageToken: "<PREV__PAGE_TOKEN>", // (optional) either `nextPageToken` or `prevPageToken`
    part: "<PART>", // (optional) default: 'id,snippet'
    key: "<YOUR_API_KEY>",
}).then(function (_data) {
    //on success
}).catch(function (_data) {
    //on error
});

getChannel

// docs: https://developers.google.com/youtube/v3/docs/search/list
youtubeFactory.getChannelById({
    channelId: "<CHANNEL_ID>", // converter: http://johnnythetank.github.io/youtube-channel-name-converter/
    nextPageToken: "<NEXT__PAGE_TOKEN>", // (optional) either `nextPageToken` or `prevPageToken`
    prevPageToken: "<PREV__PAGE_TOKEN>", // (optional) either `nextPageToken` or `prevPageToken`
    part: "<PART>", // (optional) default: 'id,snippet'
    key: "<YOUR_API_KEY>",
}).then(function (_data) {
    //on success
}).catch(function (_data) {
    //on error
});

Youtube Data JSON API

  • Docs: https://developers.google.com/youtube/v3/docs/
  • API Explorer: https://developers.google.com/apis-explorer/#p/youtube/v3/
  • Youtube Username to Channel ID Converter: http://johnnythetank.github.io/youtube-channel-name-converter/

More angular-api-factories

bandsintown - dailymotion - facebook - flickr - footballdata - github - openweathermap - tumblr - vimeo - wikipedia - youtube

License

MIT