stable #1
3 changed files with 14 additions and 2 deletions
|
|
@ -20,7 +20,7 @@ Node modules :
|
||||||
|
|
||||||
Web components :
|
Web components :
|
||||||
- [FontAwesome](https://fontawesome.com/) - Icon pack
|
- [FontAwesome](https://fontawesome.com/) - Icon pack
|
||||||
- [UIKit](https://getuikit.com/) - Front end framework
|
- [UIkit](https://getuikit.com/) - Front end framework
|
||||||
- [JavaScript Cookie](https://github.com/js-cookie/js-cookie) - JS cookie API
|
- [JavaScript Cookie](https://github.com/js-cookie/js-cookie) - JS cookie API
|
||||||
|
|
||||||
## Authors
|
## Authors
|
||||||
|
|
|
||||||
7
gplay.js
7
gplay.js
|
|
@ -1,16 +1,21 @@
|
||||||
import GPlay from 'google-play-scraper';
|
import GPlay from 'google-play-scraper';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
/*
|
||||||
|
Google Play search using scraper API
|
||||||
|
*/
|
||||||
search: (query, callback) => {
|
search: (query, callback) => {
|
||||||
|
// First request : get search results
|
||||||
GPlay.search({
|
GPlay.search({
|
||||||
term: query.name,
|
term: query.name,
|
||||||
num: query.number,
|
num: query.number,
|
||||||
price: query.price,
|
price: query.price,
|
||||||
fullDetail: true
|
fullDetail: true // 1 more request per app to get app details (excepted permissions)
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
let i = 0;
|
let i = 0;
|
||||||
res.forEach(app => {
|
res.forEach(app => {
|
||||||
|
// 1 more request per app to get permissions
|
||||||
GPlay.permissions({ appId: app.appId })
|
GPlay.permissions({ appId: app.appId })
|
||||||
.then(permissionsList => {
|
.then(permissionsList => {
|
||||||
app.permissions = permissionsList;
|
app.permissions = permissionsList;
|
||||||
|
|
|
||||||
7
index.js
7
index.js
|
|
@ -3,14 +3,21 @@ import express from 'express';
|
||||||
import http from 'http';
|
import http from 'http';
|
||||||
import socketio from 'socket.io';
|
import socketio from 'socket.io';
|
||||||
|
|
||||||
|
/*
|
||||||
|
Express server
|
||||||
|
*/
|
||||||
const app = express();
|
const app = express();
|
||||||
app.use(express.static('public'));
|
app.use(express.static('public'));
|
||||||
|
|
||||||
const server = http.createServer(app);
|
const server = http.createServer(app);
|
||||||
server.listen(3593);
|
server.listen(3593);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Socket.IO server
|
||||||
|
*/
|
||||||
const io = socketio.listen(server);
|
const io = socketio.listen(server);
|
||||||
|
|
||||||
io.on('connection', socket => {
|
io.on('connection', socket => {
|
||||||
|
// Play search socket request
|
||||||
socket.on('search', query => Play.search(query, res => socket.emit('res', res)));
|
socket.on('search', query => Play.search(query, res => socket.emit('res', res)));
|
||||||
});
|
});
|
||||||
Reference in a new issue