├── public ├── CNAME ├── .DS_Store ├── logo.png ├── manifest.json └── index.html ├── .gitignore ├── .DS_Store ├── src ├── css │ └── index.css ├── index.js ├── components │ ├── App.js │ ├── common │ │ └── Header.js │ └── pages │ │ ├── Home.js │ │ └── Search.js └── registerServiceWorker.js ├── .idea ├── vcs.xml ├── modules.xml ├── angularattack2017-manishbisht.iml └── workspace.xml ├── README.md ├── package.json ├── LICENSE.md └── README-OLD.md /public/CNAME: -------------------------------------------------------------------------------- 1 | ngdownloader.space -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | node_modules 3 | build -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manishbisht/ngDownloader/HEAD/.DS_Store -------------------------------------------------------------------------------- /public/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manishbisht/ngDownloader/HEAD/public/.DS_Store -------------------------------------------------------------------------------- /public/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manishbisht/ngDownloader/HEAD/public/logo.png -------------------------------------------------------------------------------- /src/css/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | font-family: sans-serif; 5 | } 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # angularattack2017-manishbisht 2 | ngDownloader that gives the download links of the videos 3 | 4 | # Demo 5 | [Demo](https://manishbisht.github.io/ngDownloader/) 6 | 7 | # Backend Code 8 | [Package deployed on Amazon AWS](https://github.com/manishbisht/ngDownloaderAPI) 9 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './css/index.css'; 4 | import App from './components/App'; 5 | import registerServiceWorker from './registerServiceWorker'; 6 | 7 | ReactDOM.render(, document.getElementById('root')); 8 | registerServiceWorker(); 9 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": "./index.html", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /.idea/angularattack2017-manishbisht.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/components/App.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { HashRouter, Route} from 'react-router-dom' 3 | import Header from './common/Header' 4 | import Home from './pages/Home' 5 | import Search from './pages/Search' 6 | 7 | class App extends Component { 8 | render() { 9 | return ( 10 | 11 |
12 |
13 |
14 | 15 | 16 |
17 |
18 |
19 | ); 20 | } 21 | } 22 | 23 | export default App; -------------------------------------------------------------------------------- /src/components/common/Header.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Link } from "react-router-dom"; 3 | import AppBar from '@material-ui/core/AppBar'; 4 | import Toolbar from '@material-ui/core/Toolbar'; 5 | import Typography from '@material-ui/core/Typography'; 6 | import IconButton from '@material-ui/core/IconButton'; 7 | import Icon from '@material-ui/core/Icon/Icon'; 8 | 9 | class Header extends Component { 10 | render() { 11 | return ( 12 | 13 | 14 | 15 | cloud_download 16 | 17 | 18 | ngDownloader 19 | 20 | 21 | 22 | ); 23 | } 24 | } 25 | 26 | export default Header; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ngdownloader", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@material-ui/core": "^4.1.3", 7 | "@material-ui/icons": "^4.2.1", 8 | "gh-pages": "^2.0.1", 9 | "query-string": "^6.8.1", 10 | "react": "^16.8.6", 11 | "react-dom": "^16.8.6", 12 | "react-router-dom": "^5.0.1" 13 | }, 14 | "devDependencies": { 15 | "react-scripts": "^3.0.1" 16 | }, 17 | "scripts": { 18 | "predeploy": "npm run build", 19 | "deploy": "gh-pages -d build", 20 | "start": "react-scripts start", 21 | "build": "react-scripts build", 22 | "test": "react-scripts test --env=jsdom", 23 | "eject": "react-scripts eject" 24 | }, 25 | "browserslist": { 26 | "production": [ 27 | ">0.2%", 28 | "not dead", 29 | "not op_mini all" 30 | ], 31 | "development": [ 32 | "last 1 chrome version", 33 | "last 1 firefox version", 34 | "last 1 safari version" 35 | ] 36 | }, 37 | "homepage": "https://ngdownloader.space" 38 | } 39 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Hackbit 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 24 | ngDownloader | Download videos from YouTube.com and a few more websites 25 | 26 | 27 | 30 |
31 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/components/pages/Home.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import Icon from '@material-ui/core/Icon/Icon'; 3 | import Typography from '@material-ui/core/Typography'; 4 | import TextField from '@material-ui/core/TextField'; 5 | import Button from '@material-ui/core/Button'; 6 | 7 | class Home extends Component { 8 | constructor(props) { 9 | super(props); 10 | 11 | this.state = { 12 | videoURL: '' 13 | }; 14 | } 15 | 16 | handleSearchValueChange(e) { 17 | this.setState({ 18 | videoURL: e.target.value, 19 | }) 20 | } 21 | 22 | getDownloadLinks() { 23 | this.props.history.push('/search?videoURL=' + this.state.videoURL) 24 | } 25 | 26 | render() { 27 | return ( 28 |
29 |
30 | cloud_download 31 |
32 |
33 | 34 | ngDownloader 35 | 36 |
37 |
38 | this.handleSearchValueChange(e)}/> 44 |
45 |
46 | 52 | 53 | 54 | 55 |
56 |
57 | ); 58 | } 59 | } 60 | 61 | export default Home; -------------------------------------------------------------------------------- /src/registerServiceWorker.js: -------------------------------------------------------------------------------- 1 | // In production, we register a service worker to serve assets from local cache. 2 | 3 | // This lets the app load faster on subsequent visits in production, and gives 4 | // it offline capabilities. However, it also means that developers (and users) 5 | // will only see deployed updates on the "N+1" visit to a page, since previously 6 | // cached resources are updated in the background. 7 | 8 | // To learn more about the benefits of this model, read https://goo.gl/KwvDNy. 9 | // This link also includes instructions on opting out of this behavior. 10 | 11 | const isLocalhost = Boolean( 12 | window.location.hostname === 'localhost' || 13 | // [::1] is the IPv6 localhost address. 14 | window.location.hostname === '[::1]' || 15 | // 127.0.0.1/8 is considered localhost for IPv4. 16 | window.location.hostname.match( 17 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 18 | ) 19 | ); 20 | 21 | export default function register() { 22 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 23 | // The URL constructor is available in all browsers that support SW. 24 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location); 25 | if (publicUrl.origin !== window.location.origin) { 26 | // Our service worker won't work if PUBLIC_URL is on a different origin 27 | // from what our page is served on. This might happen if a CDN is used to 28 | // serve assets; see https://github.com/facebookincubator/create-react-app/issues/2374 29 | return; 30 | } 31 | 32 | window.addEventListener('load', () => { 33 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 34 | 35 | if (isLocalhost) { 36 | // This is running on localhost. Lets check if a service worker still exists or not. 37 | checkValidServiceWorker(swUrl); 38 | 39 | // Add some additional logging to localhost, pointing developers to the 40 | // service worker/PWA documentation. 41 | navigator.serviceWorker.ready.then(() => { 42 | console.log( 43 | 'This web app is being served cache-first by a service ' + 44 | 'worker. To learn more, visit https://goo.gl/SC7cgQ' 45 | ); 46 | }); 47 | } else { 48 | // Is not local host. Just register service worker 49 | registerValidSW(swUrl); 50 | } 51 | }); 52 | } 53 | } 54 | 55 | function registerValidSW(swUrl) { 56 | navigator.serviceWorker 57 | .register(swUrl) 58 | .then(registration => { 59 | registration.onupdatefound = () => { 60 | const installingWorker = registration.installing; 61 | installingWorker.onstatechange = () => { 62 | if (installingWorker.state === 'installed') { 63 | if (navigator.serviceWorker.controller) { 64 | // At this point, the old content will have been purged and 65 | // the fresh content will have been added to the cache. 66 | // It's the perfect time to display a "New content is 67 | // available; please refresh." message in your web app. 68 | console.log('New content is available; please refresh.'); 69 | } else { 70 | // At this point, everything has been precached. 71 | // It's the perfect time to display a 72 | // "Content is cached for offline use." message. 73 | console.log('Content is cached for offline use.'); 74 | } 75 | } 76 | }; 77 | }; 78 | }) 79 | .catch(error => { 80 | console.error('Error during service worker registration:', error); 81 | }); 82 | } 83 | 84 | function checkValidServiceWorker(swUrl) { 85 | // Check if the service worker can be found. If it can't reload the page. 86 | fetch(swUrl) 87 | .then(response => { 88 | // Ensure service worker exists, and that we really are getting a JS file. 89 | if ( 90 | response.status === 404 || 91 | response.headers.get('content-type').indexOf('javascript') === -1 92 | ) { 93 | // No service worker found. Probably a different app. Reload the page. 94 | navigator.serviceWorker.ready.then(registration => { 95 | registration.unregister().then(() => { 96 | window.location.reload(); 97 | }); 98 | }); 99 | } else { 100 | // Service worker found. Proceed as normal. 101 | registerValidSW(swUrl); 102 | } 103 | }) 104 | .catch(() => { 105 | console.log( 106 | 'No internet connection found. App is running in offline mode.' 107 | ); 108 | }); 109 | } 110 | 111 | export function unregister() { 112 | if ('serviceWorker' in navigator) { 113 | navigator.serviceWorker.ready.then(registration => { 114 | registration.unregister(); 115 | }); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /src/components/pages/Search.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import Grid from '@material-ui/core/Grid'; 3 | import Typography from "@material-ui/core/Typography"; 4 | import CircularProgress from '@material-ui/core/CircularProgress'; 5 | import Table from '@material-ui/core/Table'; 6 | import TableBody from '@material-ui/core/TableBody'; 7 | import TableCell from '@material-ui/core/TableCell'; 8 | import TableHead from '@material-ui/core/TableHead'; 9 | import TableRow from '@material-ui/core/TableRow'; 10 | import Button from "@material-ui/core/Button"; 11 | const queryString = require('query-string'); 12 | 13 | class Search extends Component { 14 | constructor(props) { 15 | super(props); 16 | 17 | this.state = { 18 | loadingState: 0, 19 | videoInformation: {} 20 | }; 21 | } 22 | 23 | getURLParams() { 24 | return queryString.parse(this.props.location.search); 25 | } 26 | 27 | componentWillMount() { 28 | this.getDownloadLinks(); 29 | } 30 | 31 | componentWillUnmount() { 32 | this.setState({ 33 | loadingState: 0, 34 | videoInformation: {} 35 | }); 36 | } 37 | 38 | getDownloadLinks() { 39 | let { videoURL } = this.getURLParams(); 40 | let URL = 'https://s1jv2959n8.execute-api.us-east-1.amazonaws.com/v1?q=' + videoURL; 41 | fetch(URL).then((response) => { 42 | response.json().then((data) => { 43 | console.log(data); 44 | this.setState({ 45 | videoInformation: data, 46 | loadingState: 1, 47 | }) 48 | }); 49 | }); 50 | } 51 | 52 | renderVideoDetails() { 53 | return ( 54 |
55 | 56 | 57 | {this.state.videoInformation.title} 60 | 61 | 62 |
63 | 64 | {this.state.videoInformation.title} 65 | 66 |
67 |
68 |
69 | {this.renderVideoDownloadSection()} 70 |
71 | ); 72 | } 73 | 74 | renderVideoDownloadSection() { 75 | return ( 76 |
77 | 78 | 79 | 80 | Video Quality 81 | Video Note 82 | Download 83 | 84 | 85 | 86 | {this.state.videoInformation.formats.map((format) => ( 87 | 88 | 89 | {format.format} 90 | 91 | {format.format_note} 92 | 93 | 96 | 100 | 101 | 102 | 103 | ))} 104 | 105 |
106 |
107 | ); 108 | } 109 | 110 | getCurrentState() { 111 | return this.state.loadingState; 112 | } 113 | 114 | render() { 115 | if (this.getCurrentState() === 0) { 116 | return ( 117 |
118 |

119 | Fetching video ... 120 |
121 | ); 122 | } 123 | return ( 124 |
125 | {this.renderVideoDetails()} 126 |
127 | ); 128 | } 129 | } 130 | 131 | export default Search; -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 113 | 114 | 115 | 116 | <a 117 | 118 | 119 | 120 | 122 | 123 | 141 | 142 | 143 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 |