-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved IG credentials to .env file + Updates Readme
- Loading branch information
Showing
8 changed files
with
494 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
IG_USERNAME=username | ||
IG_PASSWORD=password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
node_modules | ||
node_modules | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,57 @@ | ||
# Cliptale 📎 | ||
|
||
Automate your Instagram stories clipping. | ||
Automate your Instagram stories clipping using Puppeteer. | ||
|
||
## Set up | ||
|
||
Open your terminal and run the following commands: | ||
|
||
```bash | ||
# Get repository | ||
git clone [email protected]:rodgracas/cliptale.git | ||
|
||
# Enter project directory | ||
cd cliptale | ||
``` | ||
|
||
- Edit the following lines of code in [clipping.js](src/clipping.js). | ||
### Instagram credentials | ||
|
||
```js | ||
const loginCredentials = { | ||
username: "yourInstagramAccountEmail", | ||
password: "yourInstagramAccountPassword", | ||
}; | ||
```bash | ||
# Create a `.env` file in project root. | ||
cp .env.sample .env | ||
``` | ||
|
||
- Edit `IG_USERNAME` and `IG_PASSWORD` environment variables with the Instagram account used to authenticate. | ||
|
||
> **Note**: The Instagram account used should not have 2FA enabled. | ||
### Instagram profile users | ||
|
||
- Edit `users.json` file in `data/` folder | ||
|
||
> **Note**: Users profiles must be available from the Instagram account used to login. | ||
|
||
## Install | ||
|
||
``` | ||
```bash | ||
# Install dependencies | ||
npm install | ||
``` | ||
|
||
## Run | ||
|
||
``` | ||
```bash | ||
# Run cliptale | ||
npm start | ||
``` | ||
|
||
> **Note**: By default `cliptale` runs in headless mode. To run in headfull mode, set `DEBUG` variable to `true` on `clipping.js` file. | ||
|
||
## Next steps | ||
|
||
- [x] Run in headless mode | ||
- [ ] Add prettier/eslint | ||
- [ ] Write tests | ||
- [ ] Typescript support | ||
- [ ] Create web application |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require('dotenv').config(); | ||
|
||
const showErrorMessage = (message) => console.error(`\x1B[31m✘ ${message}`); | ||
|
||
/** | ||
* Returns true if environment variables are set, false otherwise. | ||
* | ||
* @returns {Boolean} | ||
*/ | ||
function isConfigValid() { | ||
if (!process.env.IG_USERNAME) { | ||
showErrorMessage("Invalid configuration: Set IG_USERNAME on .env file"); | ||
process.exit(1); | ||
} | ||
|
||
if (!process.env.IG_PASSWORD) { | ||
showErrorMessage("Invalid configuration: Set IG_PASSWORD on .env file"); | ||
process.exit(1); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
isConfigValid(); | ||
|
||
module.exports = { | ||
IG_USERNAME: process.env.IG_USERNAME, | ||
IG_PASSWORD: process.env.IG_PASSWORD | ||
}; |
Oops, something went wrong.