repl.it
@jajoosam/

quote-scraper-2

Express

Quotes scraped in just a few lines of js!

fork
loading
Files
  • index.js
  • quote.pug
  • Packager files
  • package-lock.json
  • package.json
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const express = require('express');
const app = express();
var x = require('x-ray')();

app.use(express.static('public'));
app.set('view engine', 'pug');
app.set('views', __dirname);

app.get('/', (req, res) => {

	x('https://quotesondesign.com',
	{ 
		quote: "#quote-content p",
		author: "#quote-title"
	}
	)(function(err, result){
		res.render('quote', result)
		console.log(result)
	});

});

app.listen(3000, () => console.log('server started'));

	x('https://www.bookdepository.com/search?searchTerm=Modern+Principles+of+Economics+Tyler+Cowen&search=Find+book',
	{ 
		quote: ".price",
		author: "#quote-title"
	}
	)(function(err, result){
		console.log(result)
	});