├── .github └── FUNDING.yml ├── .gitignore ├── CONTRIBUTING.md ├── DOCUMENTATION.md ├── LICENSE ├── README.md ├── bin └── scrape-it-cli.js ├── example └── config.json ├── lib └── index.js └── package.json /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: ionicabizau 2 | patreon: ionicabizau 3 | open_collective: ionicabizau 4 | custom: https://www.buymeacoffee.com/h96wwchmy -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *.swo 3 | *~ 4 | *.log 5 | node_modules 6 | *.env 7 | .DS_Store 8 | package-lock.json 9 | .bloggify/* 10 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # 🌟 Contributing 2 | 3 | Want to contribute to this project? Great! Please read these quick steps to streamline the process and avoid unnecessary tasks. ✨ 4 | 5 | ## 💬 Discuss Changes 6 | Start by opening an issue in the repository using the [bug tracker][1]. Describe your proposed contribution or the bug you've found. If relevant, include platform info and screenshots. 🖼️ 7 | 8 | Wait for feedback before proceeding unless the fix is straightforward, like a typo. 📝 9 | 10 | ## 🔧 Fixing Issues 11 | 12 | Fork the project and create a branch for your fix, naming it `some-great-feature` or `some-issue-fix`. Commit changes while following the [code style][2]. If the project has tests, add one. ✅ 13 | 14 | If a `package.json` or `bower.json` exists, add yourself to the `contributors` array; create it if it doesn't. 🙌 15 | 16 | ```json 17 | { 18 | "contributors": [ 19 | "Your Name (http://your.website)" 20 | ] 21 | } 22 | ``` 23 | 24 | ## 📬 Creating a Pull Request 25 | Open a pull request and reference the initial issue (e.g., *fixes #*). Provide a clear title and consider adding visual aids for clarity. 📊 26 | 27 | ## ⏳ Wait for Feedback 28 | Your contributions will be reviewed. If feedback is given, update your branch as needed, and the pull request will auto-update. 🔄 29 | 30 | ## 🎉 Everyone Is Happy! 31 | Your contributions will be merged, and everyone will appreciate your effort! 😄❤️ 32 | 33 | Thanks! 🤩 34 | 35 | [1]: /issues 36 | [2]: https://github.com/IonicaBizau/code-style -------------------------------------------------------------------------------- /DOCUMENTATION.md: -------------------------------------------------------------------------------- 1 | ## Documentation 2 | 3 | You can see below the API reference of this module. 4 | 5 | ### `scrapeItCli(a, b)` 6 | CLI for scrape-it. A Node.js scraper for humans. :rocket: 7 | 8 | #### Params 9 | 10 | - **Number** `a`: Param descrpition. 11 | - **Number** `b`: Param descrpition. 12 | 13 | #### Return 14 | - **Number** Return description. 15 | 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018-25 Ionică Bizău (https://ionicabizau.net) 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | # `$ scrape-it` 21 | 22 | [![Support me on Patreon][badge_patreon]][patreon] [![Buy me a book][badge_amazon]][amazon] [![PayPal][badge_paypal_donate]][paypal-donations] [![Ask me anything](https://img.shields.io/badge/ask%20me-anything-1abc9c.svg)](https://github.com/IonicaBizau/ama) [![Version](https://img.shields.io/npm/v/scrape-it-cli.svg)](https://www.npmjs.com/package/scrape-it-cli) [![Downloads](https://img.shields.io/npm/dt/scrape-it-cli.svg)](https://www.npmjs.com/package/scrape-it-cli) [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/@johnnyb?utm_source=github&utm_medium=button&utm_term=johnnyb&utm_campaign=github) 23 | 24 | Buy Me A Coffee 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | > CLI for scrape-it. A Node.js scraper for humans. :rocket: 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | ## :cloud: Installation 51 | 52 | You can install the package globally and use it as command line tool: 53 | 54 | 55 | ```sh 56 | # Using npm 57 | npm install --global scrape-it-cli 58 | 59 | # Using yarn 60 | yarn global add scrape-it-cli 61 | ``` 62 | 63 | :bulb: **ProTip**: If you want to use this package as module, check out [`scrape-it`—the API version of it](https://github.com/IonicaBizau/scrape-it). 64 | 65 | 66 | 67 | Then, run `scrape-it --help` and see what the CLI tool can do. 68 | 69 | 70 | ``` 71 | $ scrape-it --help 72 | Usage: scrape-it [options] 73 | 74 | CLI for scrape-it. A Node.js scraper for humans. :rocket: 75 | 76 | Options: 77 | -u, --url The url to scrape. 78 | -c, --config The config path. It should be a js/json file 79 | containing the scrape-it schema. 80 | -h, --help Displays this help. 81 | -v, --version Displays version information. 82 | 83 | Examples: 84 | $ scrape-it -c config.json -u https://ionicabizau.net 85 | 86 | Documentation can be found at https://github.com/IonicaBizau/scrape-it-cli#readme. 87 | ``` 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | ## :question: Get Help 112 | 113 | There are few ways to get help: 114 | 115 | 116 | 117 | 1. Please [post questions on Stack Overflow](https://stackoverflow.com/questions/ask). You can open issues with questions, as long you add a link to your Stack Overflow question. 118 | 2. For bug reports and feature requests, open issues. :bug: 119 | 3. For direct and quick help, you can [use Codementor](https://www.codementor.io/johnnyb). :rocket: 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | ## :memo: Documentation 128 | 129 | For full API reference, see the [DOCUMENTATION.md][docs] file. 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | ## :yum: How to contribute 143 | Have an idea? Found a bug? See [how to contribute][contributing]. 144 | 145 | 146 | ## :sparkling_heart: Support my projects 147 | I open-source almost everything I can, and I try to reply to everyone needing help using these projects. Obviously, 148 | this takes time. You can integrate and use these projects in your applications *for free*! You can even change the source code and redistribute (even resell it). 149 | 150 | However, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it: 151 | 152 | 153 | - Starring and sharing the projects you like :rocket: 154 | - [![Buy me a book][badge_amazon]][amazon]—I love books! I will remember you after years if you buy me one. :grin: :book: 155 | - [![PayPal][badge_paypal]][paypal-donations]—You can make one-time donations via PayPal. I'll probably buy a ~~coffee~~ tea. :tea: 156 | - [![Support me on Patreon][badge_patreon]][patreon]—Set up a recurring monthly donation and you will get interesting news about what I'm doing (things that I don't share with everyone). 157 | - **Bitcoin**—You can send me bitcoins at this address (or scanning the code below): `1P9BRsmazNQcuyTxEqveUsnf5CERdq35V6` 158 | 159 | ![](https://i.imgur.com/z6OQI95.png) 160 | 161 | 162 | Thanks! :heart: 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 | ## :scroll: License 188 | 189 | [MIT][license] © [Ionică Bizău][website] 190 | 191 | 192 | 193 | 194 | 195 | 196 | [license]: /LICENSE 197 | [website]: https://ionicabizau.net 198 | [contributing]: /CONTRIBUTING.md 199 | [docs]: /DOCUMENTATION.md 200 | [badge_patreon]: https://ionicabizau.github.io/badges/patreon.svg 201 | [badge_amazon]: https://ionicabizau.github.io/badges/amazon.svg 202 | [badge_paypal]: https://ionicabizau.github.io/badges/paypal.svg 203 | [badge_paypal_donate]: https://ionicabizau.github.io/badges/paypal_donate.svg 204 | [patreon]: https://www.patreon.com/ionicabizau 205 | [amazon]: http://amzn.eu/hRo9sIZ 206 | [paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RVXDDLKKLQRJW 207 | -------------------------------------------------------------------------------- /bin/scrape-it-cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | "use strict"; 3 | 4 | const Tilda = require("tilda") 5 | , scrapeIt = require("scrape-it") 6 | , path = require("path") 7 | ; 8 | 9 | new Tilda(`${__dirname}/../package.json`, { 10 | options: [ 11 | { 12 | name: "config" 13 | , opts: ["c", "config"] 14 | , desc: "The config path. It should be a js/json file containing the scrape-it schema." 15 | , required: true 16 | , type: String 17 | }, 18 | { 19 | name: "url" 20 | , opts: ["u", "url"] 21 | , desc: "The url to scrape." 22 | , required: true 23 | } 24 | ], 25 | examples: [ 26 | "scrape-it -c config.json -u https://ionicabizau.net" 27 | ] 28 | }).main(action => { 29 | let config = {} 30 | try { 31 | config = require(path.resolve(process.cwd(), action.options.config.value)) 32 | } catch (e) { 33 | action.exit(e) 34 | } 35 | 36 | scrapeIt(action.options.url.value, config).then(({ data }) => { 37 | console.log(JSON.stringify(data)) 38 | }).catch(err => { 39 | action.exit(err) 40 | }) 41 | }); 42 | -------------------------------------------------------------------------------- /example/config.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "title": ".header h1" 4 | , "desc": ".header h2" 5 | , "avatar": { 6 | "selector": ".header img" 7 | , "attr": "src" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | /** 4 | * scrapeItCli 5 | * CLI for scrape-it. A Node.js scraper for humans. :rocket: 6 | * 7 | * @name scrapeItCli 8 | * @function 9 | * @param {Number} a Param descrpition. 10 | * @param {Number} b Param descrpition. 11 | * @return {Number} Return description. 12 | */ 13 | module.exports = function scrapeItCli (a, b) { 14 | return a + b; 15 | }; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "bin": { 3 | "scrape-it": "bin/scrape-it-cli.js" 4 | }, 5 | "name": "scrape-it-cli", 6 | "description": "CLI for scrape-it. A Node.js scraper for humans. :rocket:", 7 | "keywords": [ 8 | "scrape", 9 | "it", 10 | "cli", 11 | "for", 12 | "a", 13 | "node", 14 | "js", 15 | "scraper", 16 | "humans", 17 | "rocket" 18 | ], 19 | "license": "MIT", 20 | "version": "1.0.3", 21 | "main": "lib/index.js", 22 | "scripts": { 23 | "test": "echo \"Error: no test specified\" && exit 1" 24 | }, 25 | "author": "Ionică Bizău (https://ionicabizau.net)", 26 | "homepage": "https://github.com/IonicaBizau/scrape-it-cli#readme", 27 | "files": [ 28 | "bin/", 29 | "app/", 30 | "lib/", 31 | "dist/", 32 | "src/", 33 | "scripts/", 34 | "resources/", 35 | "menu/", 36 | "cli.js", 37 | "index.js", 38 | "index.d.ts", 39 | "package-lock.json", 40 | "bloggify.js", 41 | "bloggify.json", 42 | "bloggify/" 43 | ], 44 | "repository": { 45 | "type": "git", 46 | "url": "git+ssh://git@github.com/IonicaBizau/scrape-it-cli.git" 47 | }, 48 | "bugs": { 49 | "url": "https://github.com/IonicaBizau/scrape-it-cli/issues" 50 | }, 51 | "dependencies": { 52 | "scrape-it": "^5.0.4", 53 | "tilda": "^4.4.13" 54 | }, 55 | "blah": { 56 | "api": "scrape-it" 57 | } 58 | } --------------------------------------------------------------------------------