Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/phantomjs
- /*
- @licstart The following is the entire license notice for the
- JavaScript code in this page.
- Copyright (C) 2020 Kris Occhipinti - https://filmsbykris.com
- The JavaScript code in this page is free software: you can
- redistribute it and/or modify it under the terms of the GNU
- General Public License (GNU GPL) as published by the Free Software
- Foundation, either version 3 of the License.
- The code is distributed WITHOUT ANY WARRANTY;
- without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
- As additional permission under GNU GPL version 3 section 7, you
- may distribute non-source (e.g., minimized or compacted) forms of
- that code without the copy of the GNU GPL normally required by
- section 4, provided you include this license notice and a URL
- through which recipients can access the Corresponding Source.
- https://www.gnu.org/licenses/gpl-3.0.txt
- @licend The above is the entire license notice
- for the JavaScript code in this page.
- */
- var products = [
- "https://www.samsclub.com/p/charmin-ultra-strong-toilet-paper-24-mega-plus-roll-bath-tissue/prod22890194",
- "https://www.samsclub.com/p/organic-evoo-2-ltr/prod21330023"
- ]
- for(i in products){
- var time = i * 4000;
- setTimeout(function(url){
- go(url);
- },time,products[i]);
- }
- var time_exit = products.length * 4000 + 3000;
- setTimeout(function(){
- phantom.exit();
- },time_exit);
- function go(url){
- console.log("===============================");
- console.log(url);
- var page = new require('webpage').create();
- page.open(url, function(status) {
- window.setTimeout(function() {
- //page.render("page.png");
- content = page.content.split("<");
- for(c of content){
- if(c.includes("sc-channel-stock-status")){
- console.log(c.split(">")[1]);
- }else if(c.includes("sc-product-header-title-container")){
- console.log(c.split(">")[1]);
- }
- }
- //phantom.exit();
- }, 2000);
- });
- }
Add Comment
Please, Sign In to add comment