Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Week-1 code #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
80 changes: 80 additions & 0 deletions Week-1/Major2001/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
var request = require("request");
var cheerio = require("cheerio");
var nodeMailer = require("nodemailer");

const price = {
iphone : 0,
oneplus : 0
};
//Do enable third party access on your gmail account
setInterval(function(){
request('https://www.amazon.in/Apple-iPhone-11-64GB-Black/dp/B07XVMDRZY/ref=sr_1_3?keywords=iphone+11&qid=1576689259&sr=8-3', function(err,res,body){
if(!err && res.statusCode==200){
const $ = cheerio.load(body);
if(parseInt($('#priceblock_ourprice').text().slice(2).replace(',',"") < price.iphone) , 10){
var transporter = nodeMailer.createTransport({
service: 'gmail',
auth: {
user: '[email protected]',
pass: 'abcd'
}
});

var mailOptions = {
from: '[email protected]',
to: '[email protected]',
subject: 'Sending Email using Node.js',
text: $('#priceblock_ourprice').text() + 'is the new price of iphone 11 on Amazon'
};

transporter.sendMail(mailOptions, function(error, info){
if (error) {
console.log(error);
} else {
console.log('Email sent: ' + info.response);
}
});
}else{
console.log(err);
}
price.iphone = parseInt($('#priceblock_ourprice').text().slice(2).replace(',',"") , 10);
};
});
request('https://www.amazon.in/Test-Exclusive-749/dp/B07DJ8K2KT/ref=sr_1_1?keywords=oneplus+7t+pro&qid=1576694621&smid=A23AODI1X2CEAE&sr=8-1', function(err,res,body){
if(!err && res.statusCode==200){
const $ = cheerio.load(body);
if(parseInt($('#priceblock_dealprice').text().slice(2).replace(',',"") < price.oneplus) , 10){
var transporter = nodeMailer.createTransport({
service: 'gmail',
auth: {
user: '[email protected]',
pass: 'abcd'
}
});

var mailOptions = {
from: '[email protected]',
to: '[email protected]',
subject: 'Sending Email using Node.js',
text: $('#priceblock_ourprice').text() + 'is the new price of oneplus7t pro on Amazon'
};

transporter.sendMail(mailOptions, function(error, info){
if (error) {
console.log(error);
} else {
console.log('Email sent: ' + info.response);
}
});
}else{
console.log(err);
}
price.oneplus = parseInt($('#priceblock_dealprice').text().slice(2).replace(',',"") ,10);
console.log(price);
};
});

},21600000);



15 changes: 15 additions & 0 deletions Week-1/Major2001/node_modules/.bin/sshpk-conv

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions Week-1/Major2001/node_modules/.bin/sshpk-conv.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions Week-1/Major2001/node_modules/.bin/sshpk-conv.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Week-1/Major2001/node_modules/.bin/sshpk-sign

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions Week-1/Major2001/node_modules/.bin/sshpk-sign.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions Week-1/Major2001/node_modules/.bin/sshpk-sign.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Week-1/Major2001/node_modules/.bin/sshpk-verify

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions Week-1/Major2001/node_modules/.bin/sshpk-verify.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions Week-1/Major2001/node_modules/.bin/sshpk-verify.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Week-1/Major2001/node_modules/.bin/uuid

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions Week-1/Major2001/node_modules/.bin/uuid.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions Week-1/Major2001/node_modules/.bin/uuid.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions Week-1/Major2001/node_modules/@types/node/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions Week-1/Major2001/node_modules/@types/node/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions Week-1/Major2001/node_modules/@types/node/assert.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading