Git Product home page Git Product logo

salvator's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

salvator's Issues

encrpyt .env file

Since the .env file contains sensitive information like the username and password, it will be better to encrypt the .env file when stored on the users system.

Error: Evaluation failed: TypeError: Cannot read property 'innerHTML' of null

This error occurred after i added the error handling features in the parseRawBirthdayData.js file. The way salvator bot scrapes for birthday data is :
const raw_links = document.querySelector( "#birthdays_content > div:nth-child(1) > div:nth-child(2) > ul" ).innerHTML; const raw_names = document.querySelector( "#birthdays_content > div:nth-child(1) > div:nth-child(2) > ul" ).innerText;
The script tries to assign raw_links and raw_names variables even when document.querySelector() returns undefined. When the try catch blocks were not introduced, it resulted into a silent error and was ignored. But after the addition of try catch this results into an error and stops the program.

Test cases for all functions inside each script file

As i am making changes to the fuctions according to the es-lint errors, i find difficult to know if the functions will work properly or not after the changes i made. This task would have been much easier if there were unit tests written for these functions.

Inhibit Sending Message Twice

Currently, salvator sends messages to everyone (whose birthday is today) when
invoked irrespective of if that person was wished already in the previous run.

This can be improved by appending the link to messenger page of the person to a
file and at the time of sending check if it's already present there. That file
should also be flushed daily.

Add scheduler

Add a scheduler to make the application all time running and execution being handled as a scheduled job.

Script Fails To Save If Directory Doesn't Exist

The path where data.json is saved is inside a folder which might not exist on
the user's PC and due to which it will give error.

This can be fixed by looking for the folder's existence and creating one if not
found.

Gives ERROR: Failed to download Chromium r609904! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download. when trying to install the module globally using npm

Steps to recreate the Error:

  1. sudo npm install -g puppeteer-salvator
  2. ERROR Occurs(while running the script install.js) , Details below:

node install.js

ERROR: Failed to download Chromium r609904! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.
{ [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/puppeteer-salvator/node_modules/puppeteer/.local-chromium'] errno: -13, code: 'EACCES', syscall: 'mkdir', path: '/usr/local/lib/node_modules/puppeteer-salvator/node_modules/puppeteer/.local-chromium' }
3. so i try this instead: echo "export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true && npm install -g puppeteer-salvator" | sudo sh
4. INSTALLS successfully after skipping the download of Chromium.
5. But when i run the command puppeteer-salvator in the terminal, gives command not found.

Fix two factor authentication case

Two factor authentication blocks the login when enabled. A possible solution can be to configure the .env file with a parameter detecting two -factor authentication state and thereby handle the case as needed.

Add cron script

Add a script to append periodically launching the script to cron.

E.g 5 0 * * * nodejs /path/to/index.js

If feasible, provide the script with all necessary commands from installation to adding to cron.

Catch error and log them

Currently the erros are not catched properly and hence when the system is
automated they are lost: catching them and printing them manually will solve
the issue.

Handle no birthday

Currently the method is independent of number of birthdays, which is a problem on days when there are no birthdays.

A simple solution for this would be adding an if statement to check length of the list of profile links.

Create windows installer

Just as linux, we can create a single script installer for windows which will
install the client and add it to cron, asking the user just the time at which
the client should launch.

cron.sh checks for node in my system even when node is installed

I am running the file on Ubuntu 16.04.4 LTS. I installed node via nvm(node version manager).
Even though node runs globally on my system it is not listed. So i suggest a better way of looking for node:
Inside the cron.sh file you are doing dpkg-query -W --showformat='${Status}\n' nodejs|grep "install ok installed" to check if node is installed or not. But later you are running which nodejs to locate its install path. I suggest you directly check using which nodejs or which node (both) to look for node. If the output from the which command results in an empty string then node/nodejs is not present on the system :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.