summaryrefslogtreecommitdiff
path: root/src/scraper/scrape.js
diff options
context:
space:
mode:
authoro5pxels <o5pxels@gmail.com>2021-04-09 20:10:46 -0500
committero5pxels <o5pxels@gmail.com>2021-04-09 20:10:46 -0500
commit1d52b0f2853ab4f275c8c0de8b73a8e7f9cb614b (patch)
treeb362e62643e094cd77e2055c34f7acb9b3a49cc3 /src/scraper/scrape.js
parent11ee6b8d9871e9604c300577294a14dcfb4cce34 (diff)
downloadStreamFinder-1d52b0f2853ab4f275c8c0de8b73a8e7f9cb614b.tar.xz
StreamFinder-1d52b0f2853ab4f275c8c0de8b73a8e7f9cb614b.zip
update README, initial commit for scrape.js
Diffstat (limited to 'src/scraper/scrape.js')
-rw-r--r--src/scraper/scrape.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/scraper/scrape.js b/src/scraper/scrape.js
new file mode 100644
index 0000000..2002130
--- /dev/null
+++ b/src/scraper/scrape.js
@@ -0,0 +1,25 @@
+const puppeteer = require('puppeteer');
+
+async function performSearch(query) {
+ const browser = await puppeteer.launch({
+ headless: false
+ });
+ const pages = await browser.pages();
+ const page = pages[0];
+ await page.goto('https://google.com');
+ const searchBox = await page.$x("/html/body/div[1]/div[3]/form/div[1]/div[1]/div[1]/div/div[2]/input");
+ await searchBox[0].type(`${query} streaming`);
+ await page.keyboard.press('Enter');
+ await page.waitForNavigation();
+ const resultsContainer = await page.$$('.r0VsPb')
+ var streamingPlatforms;
+ var streamingPrices;
+ for (let i = 0; i < resultsContainer.length; i++) {
+ streamingPlatforms = await resultsContainer[i].$$eval('.i3LlFf', nodes => nodes.map(n => n.innerText));
+ streamingPrices = await resultsContainer[i].$$eval('.V8xno', nodes => nodes.map(n => n.innerText))
+ }
+ console.log(streamingPlatforms);
+ console.log(streamingPrices);
+}
+
+// performSearch("sorry to bother you") \ No newline at end of file