{"_id":"@angeligareta/tfapl","_rev":"4-b03843f146e9b670073e0ac76834f1ee","name":"@angeligareta/tfapl","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@angeligareta/tfapl","version":"1.0.0","description":"Extension of the Egg languaging program using the YouTube Api.","main":"main.js","scripts":{"start":"node main.js examples/youtube.egg","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/ULL-ESIT-PL-1718/tfa-angeligareta.git"},"keywords":["egg","youtube","api"],"author":{"name":"Ángel Igareta","email":"angeliton@hotmail.es","url":"https://github.com/angeligareta"},"license":"ISC","bugs":{"url":"https://github.com/ULL-ESIT-PL-1718/tfa-angeligareta/issues"},"homepage":"https://github.com/ULL-ESIT-PL-1718/tfa-angeligareta#readme","dependencies":{"@angeligareta/egg":"^2.7.0","@angeligareta/youtube-api-features":"^1.0.3","colors":"^1.2.5"},"gitHead":"b21471cfcfa291c7d93475652682a909227bbc9d","_id":"@angeligareta/tfapl@1.0.0","_shasum":"c812b7cf7edf39776d797982f5cfba000995fa8a","_from":".","_npmVersion":"3.5.2","_nodeVersion":"6.11.4","_npmUser":{"name":"angeligareta","email":"angeliton@hotmail.es"},"dist":{"shasum":"c812b7cf7edf39776d797982f5cfba000995fa8a","tarball":"https://registry.npmjs.org/@angeligareta/tfapl/-/tfapl-1.0.0.tgz","fileCount":17,"unpackedSize":24070,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa+DApCRA9TVsSAnZWagAAyNsP/03NdAp0NDNA2hUkXPqS\nPc9vCQE6OHOvPRFU4Mkr2bCqex4HP+qHcWWczNlk8/f79771T6wPsWJRWd7V\nqxT8LBf1BbWeDT4BU8waVwzCp1UyV6KIsQxDUFMXlZjJXWhY2HX2pCOIN0DK\ncfUEDRavt4sFNYQMCATFTK+sawVxOw87QyuRVJO0en1UA+UqbmofQMEKcwYC\nD6++i2IO9nsmiK1kV0h5TnXDitvdXwcRb8zK1Zn4vUHEUBxKUmljdMwhVUCC\n5bQfx5O5QNXJzeSNn5C0lBbxlrEm06HTIA0uQszOaDFrP/CYdfRt+a+LifeH\nbfT8FWHgsbEmGi2TRHDI7hj18884kXGlcBbCA64+WWz4UKJs6zger1Ptg/UZ\n4UYUz4rmmEiSgd+DsKCd9bndWhUdlepdFbRwNQF0GwP1AplED4DHjZjLpqIe\ngqzWoAeMQpGN3lVhPQDTmiJ6WHLJ1bxJXCmdrjXX3UjJqcmghMD6+3ajhJ5B\nEPzCUSDnk3G+gHw5R6uUKS6ksJl/ZL9JdmQV11JnCN6WVhzlWHwGUJJt1VOe\ntXkgagXEu3+ZowOQYIfP1IGBVXn0tJCxw7cR+lx9oBjmAiBdmb0mVMHsK6Pr\niKZFQDdK9WAeWAmy9rWRtfH72a8Q03IWnrI7SXxggq/soK4Jv0hVn5+mS1/X\n0f04\r\n=Udty\r\n-----END PGP SIGNATURE-----\r\n","integrity":"sha512-2QapBkcY91L4SotDV55cP7eM8dYRmvOuBrxnZiWnG3MIGZWREdVD2q7Xs3MOGi0VTNS6PNbCueREf/LwqXvyxA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCBtzlcXrWSCyAlB0KIsWnnRNK8Ch9iXWmx7im2Q2PVKwIhANslwId81lce3DyKCTDtNlYQ4mGDEjfx9lPLe34e+Vp5"}]},"maintainers":[{"name":"angeligareta","email":"angeliton@hotmail.es"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tfapl_1.0.0_1526214696248_0.7243018803730836"},"_hasShrinkwrap":false},"1.0.1":{"name":"@angeligareta/tfapl","version":"1.0.1","description":"Extension of the Egg languaging program using the YouTube Api.","main":"main.js","scripts":{"start":"node main.js examples/youtube.egg","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/ULL-ESIT-PL-1718/tfa-angeligareta.git"},"keywords":["egg","youtube","api"],"author":{"name":"Ángel Igareta","email":"angeliton@hotmail.es","url":"https://github.com/angeligareta"},"license":"ISC","bugs":{"url":"https://github.com/ULL-ESIT-PL-1718/tfa-angeligareta/issues"},"homepage":"https://github.com/ULL-ESIT-PL-1718/tfa-angeligareta#readme","dependencies":{"@angeligareta/egg":"^2.7.0","@angeligareta/youtube-api-features":"^1.0.3","colors":"^1.2.5"},"gitHead":"7554b5655c45bb320d3a7d4fa13d6783819e7742","_id":"@angeligareta/tfapl@1.0.1","_npmVersion":"5.8.0","_nodeVersion":"9.7.0","_npmUser":{"name":"angeligareta","email":"angeliton@hotmail.es"},"dist":{"integrity":"sha512-SIWDA1GZSCG4bEXt5vkw0vF1zh35NyS1LmiMtv22yuEUeTbWyqdbQ3j7ZNwI34iwpPI/ArhNnlibEZhj9HJAkA==","shasum":"4c3c69486638d8fb8adfb90c78af4c5e9e91cd5b","tarball":"https://registry.npmjs.org/@angeligareta/tfapl/-/tfapl-1.0.1.tgz","fileCount":16,"unpackedSize":22878,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa+DJOCRA9TVsSAnZWagAAb2MP/2UFbaYOhlG6QhWnGn5u\nCYPWpt5o+bXAmdLZzswXyJD7CjyBK9jk3bMCDkcJYEoxxRvZBDSsYL4bNjPK\n8WK9KjWQ8BPGO06YObKHAB4whSQGP0HqMQ5eJzheH0K6s/GgznXxX9Lx7A1Z\njzUpXuoJNtnXL1wbMWhrA5FEwN/2qcaepdsW/MrF6ma/ZfhWw9/P/Am3sBTR\nxyu0kVgPzYI1O216iFLiZQg2mJalu4bEicPMEOXS8jmee9TXCorSTQQSSZbj\nJBSQ8ZkCfytU9XDE5+EceBF935AYvGz0lZvmgkdlMdJqV7fQyOzgDxbxTfQ4\ntYETSHwXlb5sITHLOuSMUozeQ0+lYSDEPapwg9UvtHKrvn2Nu+r7TWxxjRP9\n5TQ2WsIfr2Kgk/oUemFUYRiqcTiJS3u62TrHW5VexN14CyHDt0y8JkF2RZ0L\n2Tg62dw/PTrvPBe/arwCNW9srYp9b00xIBGk+06zOckWEDzgHPeLaBOwSMvf\nIkvrKsbbWp6fcrqpT+XA2RUFCt1dtcX8FpMF8KtRjHUKOR7FWtKS/2YKb3jo\nFt+poqzo+5SViM1Irvq+Duc5t43xpEuNnzkeOfut4YzkzV8j0dOi0FCH4LjX\nZ9m3vOAPZJkmYDUYfHBupKq6VTFiUU3UvTRR5xqdCt1HFE2SVJA8kELnuP6v\nrK7p\r\n=9t73\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBFDOp05OmQrJuZlojFNoLgAr2pEPpIcGCCLcQckUsTGAiAFEEK1QgXhjgP+pbeaCTy0eBAOjc0iTAjSBncb5L6atA=="}]},"maintainers":[{"name":"angeligareta","email":"angeliton@hotmail.es"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tfapl_1.0.1_1526215245638_0.06657790607329317"},"_hasShrinkwrap":false}},"time":{"created":"2018-05-13T12:31:35.984Z","1.0.0":"2018-05-13T12:31:36.366Z","modified":"2022-06-12T14:41:32.391Z","1.0.1":"2018-05-13T12:40:45.747Z"},"maintainers":[{"name":"angeligareta","email":"angeliton@hotmail.es"}],"description":"Extension of the Egg languaging program using the YouTube Api.","homepage":"https://github.com/ULL-ESIT-PL-1718/tfa-angeligareta#readme","keywords":["egg","youtube","api"],"repository":{"type":"git","url":"git+https://github.com/ULL-ESIT-PL-1718/tfa-angeligareta.git"},"author":{"name":"Ángel Igareta","email":"angeliton@hotmail.es","url":"https://github.com/angeligareta"},"bugs":{"url":"https://github.com/ULL-ESIT-PL-1718/tfa-angeligareta/issues"},"license":"ISC","readme":"# Final Programming Language Project of Ángel Igareta\n[![npm version](https://badge.fury.io/js/%40angeligareta%2Ftfapl.svg)](https://badge.fury.io/js/%40angeligareta%2Ftfapl)\n\n## Description\nThe aim of this project was to extend the [EGG language that we had previously made](https://github.com/ULL-ESIT-PL-1718/a-programming-language-angeligareta) with anything we wanted. In this final project, I wanted to try something different.\n\nI have been always a lover of social media, more specific in YouTube, so I decided to try the [YouTube API](https://developers.google.com/youtube/v3/getting-started) and let it surprise me. After several hours of investigation (due there is not much information) I decided to start experimenting with it and do a npm module explaining what I have learnt.\n\nFor not repeating the description of the module, I ask you to follow this link and see what I made: [YouTube-API-Features](https://www.npmjs.com/package/@angeligareta/youtube-api-features)\n\nThe next step was to adapt it to egg. To make it clean I decided to use registry pattern and change the [egg npm module](https://badge.fury.io/js/%40angeligareta%2Fegg) in order to export the topEnv hash, that contains some functions that we can use in egg language. That's what I made, first I made an main program that receives an egg language program and run it, but before I require a new file: the youtube-egg.js file, that will extend the egg behavior.\n\n## YouTube EGG\nIn this file, first of all I require the YouTube features module that I explained previously and the topEnv map that allow us to extend the egg behaviour. Besides I assign to all the functions that offer the egg YouTube module to an error function, beacuse, in order to use the module, the user first have to 'require' it, by writing 'use(\"youtube\")'.\n```javascript\n// Necessary function for using youtube api features module.\nconst startFunctionOnMode = require('@angeligareta/youtube-api-features');\nconst fs = require('fs');\nconst colors = require('colors');\nconst printTitle = (string) => console.log(colors.yellow(string));\n\n// We require topEnv for adding the necessary functions in order yo use youtube module.\nlet {topEnv} = require('@angeligareta/egg');\n\n// In case the youtube function has not been required, show error.\ntopEnv['showYouTubeHelp'] = showError;\ntopEnv['showComments'] = showError;\ntopEnv['showChannelInfo'] = showError;\ntopEnv['showChannelVideos'] = showError;\ntopEnv['searchVideos'] = showError;\ntopEnv['searchChannels'] = showError;\n\nfunction showError() {\n\tthrow new TypeError(\"In order to use youtube module functions, you must 'use' the youtube module as follow: \\n\" +\n\t\t\"\\t use(\\\"youtube\\\")\");\n}\n```\n\nAfter that, I add the function 'use' to the topEnv and assign the correct functions to the functions that offer the egg YouTube module. However, before we must check if the user has the client_secret.json in the working directory, due it's necessary for using the youtube api. If you want to test it I recommend you to follow this tutorial for Node.JS: [Node.js QuickStart](https://developers.google.com/youtube/v3/quickstart/nodejs)\n\n```javascript\n// If the user writes 'use(\"youtube\")' we assign the correct functions to the topEnv. However, before we check if the user has\n// the client_secret.json in the working directory, due it's necessary for using the youtube api.\ntopEnv['use'] = function(...argumentArray) {\n\tif (argumentArray.length !== 1) {\n\t\tthrow new TypeError('Use function must receive only one argument.');\n\t}\n\telse {\n\t\tif (argumentArray[0].toLowerCase() === 'youtube') { // Update libraries\n\t\t\tif (!fs.existsSync('client_secret.json')) { // Check if it has the necessary api key.\n\t\t\t\tthrow new TypeError('In order to use youtube module functions, you must have a client_secret.json file!');\n\t\t\t}\n\n\t\t\tconsole.log(\"YouTube Module charged! To show help use: showYouTubeHelp\");\n\t\t\ttopEnv['showYouTubeHelp'] = showYouTubeHelp;\n\t\t\ttopEnv['showComments'] = showComments;\n\t\t\ttopEnv['showChannelInfo'] = showChannelInfo;\n\t\t\ttopEnv['showChannelVideos'] = showChannelVideos;\n\t\t\ttopEnv['searchVideos'] = searchVideos;\n\t\t\ttopEnv['searchChannels'] = searchChannels;\n\t\t}\n\t}\n};\n```\n\n## How to use\nFor using it the first requisite is to have the client_secret.json file that offer the youtube API. In order to do that follow this tutorial for Node.JS: [Node.js QuickStart](https://developers.google.com/youtube/v3/quickstart/nodejs)\n\nAfter that you have a set of examples in the examples folder to try. You can enter by command line:\n```\nnpm start\n```\n\nOr\n\n```\nnode main.js examples/<example>.egg\n```\n\nHave fun!\n\n## Author\n[Ángel Igareta](https://github.com/angeligareta)\n","readmeFilename":"README.md"}