{"id":19492402,"url":"https://github.com/cosmitar/youtube-client-wrapper","last_synced_at":"2025-10-09T14:49:59.387Z","repository":{"id":84689706,"uuid":"46383648","full_name":"Cosmitar/youtube-client-wrapper","owner":"Cosmitar","description":"Javascript wrapper to simplify the implementation of Youtube API client","archived":false,"fork":false,"pushed_at":"2017-02-15T06:29:28.000Z","size":36,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-23T05:05:29.835Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cosmitar.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-18T00:05:54.000Z","updated_at":"2017-02-15T06:29:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"91062b0d-561b-4fbe-944b-9685013c8bdf","html_url":"https://github.com/Cosmitar/youtube-client-wrapper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Cosmitar/youtube-client-wrapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cosmitar%2Fyoutube-client-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cosmitar%2Fyoutube-client-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cosmitar%2Fyoutube-client-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cosmitar%2Fyoutube-client-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cosmitar","download_url":"https://codeload.github.com/Cosmitar/youtube-client-wrapper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cosmitar%2Fyoutube-client-wrapper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001504,"owners_count":26083118,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T21:20:47.913Z","updated_at":"2025-10-09T14:49:59.369Z","avatar_url":"https://github.com/Cosmitar.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YouTube Web API Wrapper | ES6\nWrapper written in ECMAScript 6. Allows a simplified use of [Google API Client (YouTube API)](https://developers.google.com/api-client-library/javascript/).\nEntity oriented approach\n\n## How simple is it?\n- Include Google API script in the html page.\n```html\n\u003cscript src=\"https://apis.google.com/js/client.js?onload=OnGoogleAPILoadCallback\"\u003e\u003c/script\u003e\n```\n- Config the API client with your API_KEY (mandatory for query) and optional CLIENT_ID and SCOPES in case you require activities with user data.\n```javascript\nimport {Config} from 'youtube-client-wrapper';\nConfig.set({\n    apiKey: 'YOUR API KEY',\n    clientId: 'YOUR CLIENT ID',//optional\n    scopes: ['https://www.googleapis.com/auth/youtube']//optional\n});\n```\n- Boot up the API, this will include the YoutTube API vía ``` gapi.client.load('youtube', 'v3')```\n```javascript\nConfig.boot().then(() =\u003e {\n    //start quering \n});\n```\n- Search a Video, Playlist, Channel or all of them together.\n```javascript\nimport {Video} from 'youtube-client-wrapper';\n\nVideo.where('Dream On, Aerosmith')\n.then((page) =\u003e {\n    //your function here\n    doSomethingWithTheVideo( page.firstElement() );\n});\n```\n```javascript\nimport {Search} from 'youtube-client-wrapper';\n\nSearch.where('adele')\n.then((page) =\u003e {\n    for( let entity of page.elements ){\n        switch( entity.name ){\n            case 'YouTubeVideo':\n                doSomethingWithVideo( entity );\n                break;\n            case 'YouTubePlaylist':\n                doSomethingWithPlaylist( entity );\n                break;\n            case 'YouTubeChannel':\n                doSomethingWithChannel( entity );\n                break;\n        }\n    }\n});\n```\n- Search a Video with extended search parameters and paginate results\n```javascript\nimport {Video} from 'youtube-client-wrapper';\nlet params = {\n    maxResults: 2,\n    safeSearch: true,\n    orderBy: 'date'\n};\nlet pager;\n\nVideo.where('Maroon 5', params)\n    .then((page =\u003e {\n        pager = page;\n        drawElements( page.elements );\n}));\n\nlet onClickNextHandler = () =\u003e {\n    pager.next()\n        .then(page =\u003e {\n            drawElements( page.elements );\n    });\n}\n```\nfor a full list of search parameters, see https://developers.google.com/apis-explorer/#p/youtube/v3/\n\n## Authorization\nConfig the CLIENT_ID and SCOPES\n```javascript\nimport {Config} from 'youtube-client-wrapper';\nConfig.set({\n    apiKey: 'YOUR API KEY',\n    clientId: 'YOUR CLIENT ID',\n    scopes: ['https://www.googleapis.com/auth/youtube']\n});\n```\nInclude the authorization service and call...\n```javascript\nimport {Auth} from 'youtube-client-wrapper';\nAuth.authorize()\n    .then( authorized, notAuthorized );\n```\nThe first time, the authorization will fail because the current user (even logged in) doesn't authorize the app ever before.\nTherefore, you need to handle the UI to offer to the user a button with a onClick function to trigger the authorization popup.\n```javascript\nnotAuthorized() {\n    let btn = document.querySelector('#login_button');\n    btn.style.visibility = 'visible';\n    btn.onclick = () =\u003e {\n        Auth.showAuth()\n            .then( authSuccess, authFail );\n    }\n}\n```\n**There's a lot of features to develope.**\n\nSee [here](https://github.com/fusenlabs/20v) a working implementation.\n\n## Development\n```git clone git@github.com:Cosmitar/youtube-client-wrapper.git```\n\n```npm install```\n\n```gulp watch```\n\nOpen the localhost:3000/demo/index.html and look for console logs\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcosmitar%2Fyoutube-client-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcosmitar%2Fyoutube-client-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcosmitar%2Fyoutube-client-wrapper/lists"}