summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoro5pxels <o5pxels@gmail.com>2021-04-10 14:20:15 -0500
committero5pxels <o5pxels@gmail.com>2021-04-10 14:20:15 -0500
commit034720cdad9e7344db4177a6fef89c6b29a5829a (patch)
tree3f9f06658cec910f7421765535f85937ba7f2507
parent41909f9189810df0d005b7c8ecac419d0118037f (diff)
downloadStreamFinder-034720cdad9e7344db4177a6fef89c6b29a5829a.tar.xz
StreamFinder-034720cdad9e7344db4177a6fef89c6b29a5829a.zip
check.js incomplete implementation, move modules to src, aexport scrape function
-rw-r--r--src/check.js18
-rw-r--r--src/package-lock.json (renamed from src/scraper/package-lock.json)0
-rw-r--r--src/package.json (renamed from src/scraper/package.json)0
-rw-r--r--src/scraper/scrape.js5
4 files changed, 18 insertions, 5 deletions
diff --git a/src/check.js b/src/check.js
index 73c58dd..c7085ca 100644
--- a/src/check.js
+++ b/src/check.js
@@ -1,4 +1,18 @@
-const mongodb = require('mongodb');
+const MongoClient = require('mongodb').MongoClient;
// This is for passing the parameters of the search to check and see if it already exists in the database
-// if it does exist, we're gonna call another function in another file. \ No newline at end of file
+// if it does exist, we're gonna call another function in another file.
+
+const scraper = require('./scraper/scrape')
+
+exports.performCheck = async function performCheck(query, type) {
+ // if (!exist in database) {
+ await scraper.performSearch(query, type);
+ // }
+ // (if it needed to be scraped, it now is, and its stored. next, we perform the database search for the newly saved entry)
+ performDatabaseSearch(query, type);
+}
+
+async function performDatabaseSearch(query, type) {
+ // do database search
+} \ No newline at end of file
diff --git a/src/scraper/package-lock.json b/src/package-lock.json
index 1e6439e..1e6439e 100644
--- a/src/scraper/package-lock.json
+++ b/src/package-lock.json
diff --git a/src/scraper/package.json b/src/package.json
index 7269165..7269165 100644
--- a/src/scraper/package.json
+++ b/src/package.json
diff --git a/src/scraper/scrape.js b/src/scraper/scrape.js
index 131ae40..a24d1e8 100644
--- a/src/scraper/scrape.js
+++ b/src/scraper/scrape.js
@@ -1,12 +1,13 @@
const puppeteer = require('puppeteer');
const mongodb = require('mongodb')
+
// Specifically for scraping
// Stores in database once finished scraping
// query is the search string (title of movie or show) and the type (music, show, movie)
// will be used
-async function performSearch(query, type) {
+exports.performSearch = async function(query, type) {
const browser = await puppeteer.launch({
headless: true
});
@@ -29,5 +30,3 @@ async function performSearch(query, type) {
// do the database storage
await browser.close();
}
-
-// performSearch('spongebob', 'tv'); \ No newline at end of file