├── AirtelBatteryStatus.user.js ├── Crunchbase.user.js ├── Daycare_Data.user.js ├── Deriv AutoClicker.user.js ├── Esty UK Product Data.user.js ├── LICENSE ├── Labor_NY_Stats.user.js ├── README.md ├── Realtor_Details.user.js ├── Realtor_Search.user.js ├── Reddit Comments Scrape.user.js ├── Startup_Village.user.js └── YouTube View Counter.user.js /AirtelBatteryStatus.user.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name Airtel Dongle Battery Status Notifier 3 | // @version 0.1 4 | // @author kowshika 5 | // @match http://airtel.4g.wi-fi 6 | // @match http://airtel.4g.wi-fi/* 7 | // @match https://airtel.4g.wi-fi 8 | // @grant GM_notification 9 | // @grant window.focus 10 | // ==/UserScript== 11 | 12 | function sleep(ms) { 13 | return new Promise(resolve => setTimeout(resolve, ms)); 14 | } 15 | async function sleepFunc() { 16 | await sleep(3000); 17 | } 18 | 19 | function has(String, search) { 20 | try { 21 | if (String.indexOf(search) > -1) { 22 | return true; 23 | } 24 | } 25 | catch (err) {} 26 | return false; 27 | } 28 | 29 | 30 | (async function() { 31 | 'use strict'; 32 | 33 | setTimeout(() => { sleepFunc(); }, 3000); 34 | if (has(window.location.href, 'index')){ 35 | if (document.getElementById('spnWanNetworkName') != null){ 36 | document.getElementById('spnWanNetworkName').click(); 37 | sleepFunc(); 38 | } 39 | 40 | if (document.getElementById('f_password') != null){ 41 | document.getElementById('f_password').click(); 42 | document.getElementById('f_password').value = 'admin'; 43 | } 44 | 45 | if (document.getElementById('f_submit_login') != null){ 46 | document.getElementById('f_submit_login').click(); 47 | sleepFunc(); 48 | } 49 | } 50 | 51 | if (has(window.location.href, 'connectionStatus')){ 52 | if (document.getElementById('ibatterylvl') != null){ 53 | var b = document.getElementById('ibatterylvl').textContent 54 | if (b != null && b != '' && b != ' ' && b < 20) { 55 | console.log ('Sending notification'); 56 | shim_GM_notification(); 57 | var notificationDetails = { 58 | text: 'Battery Low : '.concat(b, '%'), 59 | title: 'Airtel Wifi', 60 | timeout: 3000, 61 | onclick: function () { 62 | console.log ("Notice clicked."); 63 | window.focus (); 64 | } 65 | }; 66 | GM_notification (notificationDetails); 67 | 68 | } 69 | else { 70 | console.log('Wifi Battery is at a healthy ' + b + '%'); 71 | } 72 | } 73 | 74 | setTimeout(() => { window.location.reload(); }, 120000); 75 | setTimeout(() => { sleepFunc(); }, 20000); 76 | 77 | } 78 | 79 | /*--- Cross-browser Shim code follows: 80 | */ 81 | function shim_GM_notification () { 82 | if (typeof GM_notification === "function") { 83 | return; 84 | } 85 | window.GM_notification = function (ntcOptions) { 86 | checkPermission (); 87 | 88 | function checkPermission () { 89 | if (Notification.permission === "granted") { 90 | fireNotice (); 91 | } 92 | else if (Notification.permission === "denied") { 93 | alert ("User has denied notifications for this page/site!"); 94 | return; 95 | } 96 | else { 97 | Notification.requestPermission ( function (permission) { 98 | console.log ("New permission: ", permission); 99 | checkPermission (); 100 | } ); 101 | } 102 | } 103 | 104 | function fireNotice () { 105 | if ( ! ntcOptions.title) { 106 | console.log ("Title is required for notification"); 107 | return; 108 | } 109 | if (ntcOptions.text && ! ntcOptions.body) { 110 | ntcOptions.body = ntcOptions.text; 111 | } 112 | var ntfctn = new Notification (ntcOptions.title, ntcOptions); 113 | 114 | if (ntcOptions.onclick) { 115 | ntfctn.onclick = ntcOptions.onclick; 116 | } 117 | if (ntcOptions.timeout) { 118 | setTimeout ( function() { 119 | ntfctn.close (); 120 | }, ntcOptions.timeout); 121 | } 122 | } 123 | } 124 | } 125 | 126 | })(); 127 | -------------------------------------------------------------------------------- /Crunchbase.user.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name Crunchbase 3 | // @namespace crunchbase.script 4 | // @version 0.1 5 | // @description Scrape pubic data from crunchbase 6 | // @author Kowshika 7 | // @match https://crunchbase.com/* 8 | // @match https://www.crunchbase.com/* 9 | // @runat document-end 10 | // @grant none 11 | 12 | // ==/UserScript== 13 | 14 | function has(String, search) { try { if (String.indexOf(search) > -1) { return true; } } catch (err) {} return false; } 15 | 16 | function waitForElementToDisplay(selector, time) { 17 | if(document.querySelector(selector) != null) { 18 | console.log(selector + ' found'); 19 | return; 20 | } 21 | else { 22 | setTimeout(function() { 23 | waitForElementToDisplay(selector, time); 24 | }, time); 25 | } 26 | } 27 | 28 | function waitForElementToDisplayWithXpath(xpath, time) { 29 | document.getElementByXPath = function(sValue) { var a = this.evaluate(sValue, this, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); if (a.snapshotLength > 0) { return a.snapshotItem(0); } }; 30 | if(document.getElementByXPath(xpath) != null) { 31 | console.log(xpath + ' found'); 32 | return; 33 | } 34 | else { 35 | setTimeout(function() { 36 | waitForElementToDisplayWithXpath(xpath, time); 37 | }, time); 38 | } 39 | } 40 | 41 | 42 | 43 | 44 | (function() { 45 | 46 | var textData = ""; 47 | 48 | function saveText(filename, text) { 49 | var tempElem = document.createElement('a'); 50 | tempElem.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); 51 | tempElem.setAttribute('download', filename); 52 | tempElem.click(); 53 | console.log(filename + ' File downloaded'); 54 | } 55 | 56 | function sleep(ms) { return new Promise(res => setTimeout(res, ms)); }; 57 | let sleepFunc = async function() { await sleep(3000); }; 58 | 59 | document.getElementByXPath = function(sValue) { var a = this.evaluate(sValue, this, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); if (a.snapshotLength > 0) { return a.snapshotItem(0); } }; 60 | document.getElementsByXPath = function(sValue){ var aResult = new Array();var a = this.evaluate(sValue, this, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);for ( var i = 0 ; i < a.snapshotLength ; i++ ){aResult.push(a.snapshotItem(i));}return aResult;}; 61 | 62 | sleepFunc(); 63 | 64 | waitForElementToDisplay('.profile-name', 5000); 65 | waitForElementToDisplay('page-footer', 5000); 66 | waitForElementToDisplay('anchored-values', 5000); 67 | 68 | if (has(window.location.href, 'organization')){ 69 | 70 | var company_name = document.getElementByXPath('//*[@class="profile-name"]').textContent.trim() 71 | var company_url = "" 72 | var headquarters = "" 73 | var Sector = "" 74 | var type = "" 75 | var symbol = "" 76 | var funding= "" 77 | var amount = "" 78 | var phone = "" 79 | 80 | if (document.getElementByXPath('(//a[@role="link"])[1]') != null) { 81 | company_url = document.getElementByXPath('(//a[@role="link"])[1]').getAttribute('href'); 82 | } 83 | 84 | if (document.getElementByXPath("//a[contains(@href, '/field/organizations/location_identifiers')]") != null) { 85 | headquarters = document.getElementByXPath("(//a[contains(@href, '/field/organizations/location_identifiers')])//..//..//span").textContent; 86 | } 87 | 88 | if (document.getElementByXPath("//mat-chip") != null) { 89 | var count = document.getElementsByXPath("//mat-chip").length; 90 | for (var i=1; i <= count; i ++){ 91 | Sector += document.getElementByXPath("(//mat-chip)[" + i.toString() + "]").textContent + ", "; 92 | } 93 | Sector = Sector.replace(/,\s*$/, ""); 94 | } 95 | 96 | if (document.getElementByXPath("//*[@title='Public']") != null){ 97 | type = "Public" 98 | } else { 99 | type = "Private" 100 | } 101 | 102 | waitForElementToDisplayWithXpath("//*[text() = 'Stock ']//..//..//..//a | //*[text() = 'Stock Symbol']//..//..//..//blob-formatter/span", 2000); 103 | if (document.getElementByXPath("//*[text() = 'Stock ']//..//..//..//a | //*[text() = 'Stock Symbol']//..//..//..//blob-formatter/span") != null){ 104 | symbol = document.getElementByXPath("//*[text() = 'Stock ']//..//..//..//a | //*[text() = 'Stock Symbol']//..//..//..//blob-formatter/span").textContent.trim(); 105 | } 106 | 107 | if (document.getElementByXPath("//span[text()='Phone Number']//..//..//..//blob-formatter/span") != null){ 108 | phone = document.getElementByXPath("(//span[text()='Phone Number']//..//..//..//span)[last()]").textContent.trim() 109 | } 110 | 111 | if (document.getElementByXPath("(//a[contains(@href, 'organizations/last_funding_type')])[1]") != null){ 112 | funding = document.getElementByXPath("(//a[contains(@href, 'organizations/last_funding_type')])[1]").textContent.trim() 113 | } 114 | 115 | if (document.getElementByXPath("(//span[contains(@class, 'field-type-money')])[1]") != null){ 116 | amount = document.getElementByXPath("(//span[contains(@class, 'field-type-money')])[1]").textContent.trim() 117 | } 118 | 119 | textData += headquarters + " | " 120 | textData += Sector + " | " 121 | textData += type + " | " 122 | textData += symbol + " | " 123 | textData += funding + " | " 124 | textData += amount + " | " 125 | textData += company_name + " | " 126 | textData += company_url + " | " 127 | textData += window.location.href + " | " 128 | textData += phone 129 | 130 | if (textData.length > 10){ 131 | saveText("listingData.txt", textData); 132 | } else { 133 | console.log('No Data found.') 134 | } 135 | 136 | } 137 | console.log('Page loaded'); 138 | 139 | })(); 140 | -------------------------------------------------------------------------------- /Daycare_Data.user.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name GA Daycares data 3 | // @namespace http://tampermonkey.net/ 4 | // @version 0.1 5 | // @description Scrape daycare info 6 | // @author Kowshika N 7 | // @match https://families.decal.ga.gov/ChildCare/detail/* 8 | // @match http://families.decal.ga.gov/ChildCare/detail/* 9 | // @include https://families.decal.ga.gov/ChildCare/detail/* 10 | // @include http://families.decal.ga.gov/ChildCare/detail/* 11 | // @include https://families.decal.ga.gov/ChildCare/Results* 12 | // @match https://families.decal.ga.gov/ChildCare/Results* 13 | // @grant none 14 | // @runat document-end 15 | // ==/UserScript== 16 | 17 | 18 | function has(String, search) { try { if (String.indexOf(search) > -1) { return true; } } catch (err) {} return false; } 19 | 20 | function waitForElementToDisplay(selector, time) { 21 | if(document.querySelector(selector) != null) { 22 | console.log(selector + ' found'); 23 | return; 24 | } 25 | else { 26 | setTimeout(function() { 27 | waitForElementToDisplay(selector, time); 28 | }, time); 29 | } 30 | } 31 | 32 | function waitForElementToDisplayWithXpath(xpath, time) { 33 | document.getElementByXPath = function(sValue) { var a = this.evaluate(sValue, this, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); if (a.snapshotLength > 0) { return a.snapshotItem(0); } }; 34 | if(document.getElementByXPath(xpath) != null) { 35 | console.log(xpath + ' found'); 36 | return; 37 | } 38 | else { 39 | setTimeout(function() { 40 | waitForElementToDisplayWithXpath(xpath, time); 41 | }, time); 42 | } 43 | } 44 | 45 | 46 | 47 | (function() { 48 | 'use strict'; 49 | var textData = ""; 50 | 51 | function saveText(filename, text) { 52 | var tempElem = document.createElement('a'); 53 | tempElem.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); 54 | tempElem.setAttribute('download', filename); 55 | tempElem.click(); 56 | console.log(filename + ' File downloaded'); 57 | } 58 | 59 | function sleep(ms) { return new Promise(res => setTimeout(res, ms)); }; 60 | let sleepFunc = async function() { await sleep(3000); }; 61 | 62 | document.getElementByXPath = function(sValue) { var a = this.evaluate(sValue, this, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); if (a.snapshotLength > 0) { return a.snapshotItem(0); } }; 63 | document.getElementsByXPath = function(sValue){ var aResult = new Array();var a = this.evaluate(sValue, this, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);for ( var i = 0 ; i < a.snapshotLength ; i++ ){aResult.push(a.snapshotItem(i));}return aResult;}; 64 | sleepFunc(); 65 | 66 | function getText(xpath){ 67 | var text = "" 68 | if (document.getElementByXPath(xpath) != null){ text = document.getElementByXPath(xpath).textContent } 69 | return text 70 | } 71 | 72 | document.onreadystatechange = function () { 73 | if (document.readyState == "complete") { 74 | waitForElementToDisplay('#Content_Main_lblFacilityName', 5000); 75 | waitForElementToDisplay('#Content_Main_imgPreK', 5000); 76 | 77 | if (has(window.location.href, '/Results')){ 78 | function keeploading(){ 79 | document.getElementById('pnlLoadMore').scrollIntoView(); 80 | document.getElementById('pnlLoadMore').click(); 81 | } 82 | 83 | function heavyWork(){ 84 | for (var i=0; i<10; i++){ 85 | console.log(i); 86 | var interval = setInterval((function(x){ 87 | return function(){ 88 | keeploading(); 89 | }; 90 | })(i), 5000); 91 | if (document.getElementById('pnlLoadMore').style.display == "none"){ 92 | window.clearInterval(interval); 93 | } 94 | } 95 | } 96 | 97 | //heavyWork(); 98 | waitForElementToDisplayWithXpath("//a[contains(@href, 'detail/')]", 10000) 99 | document.getElementById('pnlSortBy').scrollIntoView(); 100 | var count = document.getElementsByXPath("//a[contains(@href, 'detail/')]").length; 101 | for (var i=1; i <= count; i++){ 102 | textData += document.getElementByXPath("(//a[contains(@href, 'detail/')])["+ i.toString()+ "]").href + "\n" 103 | } 104 | 105 | if (textData.length > 40){ 106 | saveText("listingLinks.txt", textData); 107 | } else { 108 | console.log('No Data found.') 109 | } 110 | } 111 | 112 | if (has(window.location.href, '/detail/')){ 113 | 114 | var DaycareName = getText("//*[contains(@id, 'FacilityName')]") 115 | var Address = getText("//address").replace(/(?:\r\n|\r|\n|\s\s)/g, ' ').replace(/\s+/g, ' ').replace('Get Directions', '').trim() 116 | var ContactName = getText("//*[contains(@id, 'Admin')]") 117 | var PhoneNumber = getText("//*[contains(@id, 'Phone')]") 118 | var Website = "" 119 | if (document.getElementByXPath("//*[contains(@id, 'Website')]//a") != null) { 120 | Website = document.getElementByXPath("//*[contains(@id, 'Website')]//a").href 121 | } 122 | var Facebook = "" 123 | if (document.getElementByXPath("//*[contains(@id, 'Facebook')]") != null) { 124 | Facebook = document.getElementByXPath("//*[contains(@id, 'Facebook')]").href 125 | } 126 | var Type = getText("//*[contains(@id, 'ProgramType')]") 127 | var Capacity = getText("//*[contains(@id, 'lblCapacity')]") 128 | 129 | textData += DaycareName + " | " 130 | textData += Address + " | " 131 | textData += ContactName + " | " 132 | textData += PhoneNumber + " | " 133 | textData += Website + " | " 134 | textData += Facebook + " | " 135 | textData += Type + " | " 136 | textData += Capacity + " | " 137 | textData += window.location.href + " | " 138 | 139 | if (textData.length > 80){ 140 | saveText("listingData.txt", textData); 141 | } else { 142 | console.log('No Data found.') 143 | } 144 | } 145 | } 146 | } 147 | 148 | })(); 149 | -------------------------------------------------------------------------------- /Deriv AutoClicker.user.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name Deriv AutoClicker 3 | // @namespace Deriv_AutoClicker_Script 4 | // @version 0.3 5 | // @description Click on Purchase when matching conditions 6 | // @author Kowshika 7 | // @match https://smarttrader.deriv.app/en/trading.html 8 | // @match https://smarttrader.deriv.app/en/trading.html* 9 | // @include https://smarttrader.deriv.app/en/trading.html* 10 | // @match https://smarttrader.deriv.*/en/trading.html 11 | // @include https://smarttrader.deriv.*/en/trading.html* 12 | // excludes * 13 | // @icon https://smarttrader.deriv.app/images/common/logos/icon_deriv.svg 14 | // @grant GM_addStyle 15 | // @grant GM_getValue 16 | // @grant GM_setValue 17 | // @license MIT 18 | // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js 19 | // @run-at document-end 20 | // ==/UserScript== 21 | 22 | function has(String, search) { try { if (String.indexOf(search) > -1) { return true; } } catch (err) {} return false; } 23 | function sleep(ms) { return new Promise(res => setTimeout(res, ms)); }; 24 | let sleepFunc = async function() { await sleep(5000); }; 25 | 26 | function waitForKeyElements(selectorTxt, actionFunction, bWaitOnce, iframeSelector) { 27 | var targetNodes, btargetsFound; 28 | if (typeof iframeSelector == "undefined") 29 | targetNodes = $(selectorTxt); 30 | else 31 | targetNodes = $(iframeSelector).contents() 32 | .find(selectorTxt); 33 | 34 | if (targetNodes && targetNodes.length > 0) { 35 | btargetsFound = true; 36 | /*--- Found target node(s). Go through each and act if they 37 | are new. 38 | */ 39 | targetNodes.each(function () { 40 | var jThis = $(this); 41 | var alreadyFound = jThis.data('alreadyFound') || false; 42 | 43 | if (!alreadyFound) { 44 | //--- Call the payload function. 45 | var cancelFound = actionFunction(jThis); 46 | if (cancelFound) 47 | btargetsFound = false; 48 | else 49 | jThis.data('alreadyFound', true); 50 | } 51 | }); 52 | } 53 | else { 54 | btargetsFound = false; 55 | } 56 | 57 | //--- Get the timer-control variable for this selector. 58 | var controlObj = waitForKeyElements.controlObj || {}; 59 | var controlKey = selectorTxt.replace(/[^\w]/g, "_"); 60 | var timeControl = controlObj[controlKey]; 61 | 62 | //--- Now set or clear the timer as appropriate. 63 | if (btargetsFound && bWaitOnce && timeControl) { 64 | //--- The only condition where we need to clear the timer. 65 | clearInterval(timeControl); 66 | delete controlObj[controlKey] 67 | } 68 | else { 69 | //--- Set a timer, if needed. 70 | if (!timeControl) { 71 | timeControl = setInterval(function () { 72 | waitForKeyElements(selectorTxt, actionFunction, bWaitOnce, iframeSelector); 73 | }, 300); 74 | controlObj[controlKey] = timeControl; 75 | } 76 | } 77 | waitForKeyElements.controlObj = controlObj; 78 | } 79 | 80 | 81 | function mainMethod(jNode) { 82 | setTimeout(function () { 83 | sleepFunc(); 84 | console.clear(); 85 | console.log('Page loaded'); 86 | document.getElementByXPath = function(sValue) { var a = this.evaluate(sValue, this, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); if (a.snapshotLength > 0) { return a.snapshotItem(0); } }; 87 | if (document.getElementByXPath("//*[@id='underlying_component']//div/span[text()='Volatility 100 Index']") == null){ 88 | document.getElementByXPath("//*[@id='underlying_component']//div[contains(@class, 'market_current')]").click(); 89 | document.getElementByXPath("//*[@id='R_100']").click(); 90 | console.log("Selected Volatility 100 Index"); 91 | } 92 | if (document.getElementByXPath("//*[@id='contract_component']//div/span[text()='Higher/Lower']") == null){ 93 | document.getElementByXPath("//*[@id='contract_component']//div[contains(@class, 'contract_current')]").click(); 94 | document.getElementByXPath("//*[@id='contract_component']//div[text()='Higher/Lower']").click(); 95 | console.log("Selected Higher/Lower"); 96 | } 97 | 98 | sleepFunc(); 99 | waitForKeyElements("#spot", checkChart); 100 | 101 | }, 5000) 102 | } 103 | 104 | 105 | function checkChart(jNode){ 106 | 107 | var match_digits = 4; 108 | var time = 1; 109 | var max = 2000000; 110 | console.clear(); 111 | var error = false; 112 | var matchedList = GM_getValue("matchList", ""); 113 | if (!matchedList) { 114 | console.log("Error calculating matchList from memory. Auto Clicker Script Not Running."); 115 | alert("Auto Clicker Script Not Running. Click on Set Match List button."); 116 | error = true; 117 | } else { 118 | 119 | var matchList = matchedList.split(",").map(item => item.trim()); 120 | console.log(matchList); 121 | if (matchList.length == 1 ){ 122 | if (matchList[0].length <= 0){ 123 | console.log("Error calculating matchList from memory. Auto Clicker Script Not Running."); 124 | alert("Auto Clicker Script Not Running. Click on Set Match List button."); 125 | error = true; 126 | } 127 | } 128 | 129 | 130 | var interval = setInterval(function() { 131 | if (!error && matchList && time <= max) { 132 | var spot = document.getElementById('spot'); 133 | if (spot != null && spot.getAttribute('class')=='price_moved_up'){ 134 | var amount = spot.textContent; 135 | var matched_digits = amount.substr(amount.length - match_digits); 136 | if (matchList.includes(matched_digits)){ 137 | 138 | if (document.getElementByXPath("//div[contains(@class, 'contract_purchase') and contains(@class, 'disabled')]") == null 139 | && document.getElementById('spot').getAttribute('class')=='price_moved_up'){ 140 | clickHigherPurchaseBtn(); 141 | console.log("Blue : " + matched_digits + " from " + amount + " matched with list " + matchList); 142 | sleepFunc(); 143 | clickcloseBtn(); 144 | sleepFunc(); 145 | } 146 | 147 | } else { 148 | console.log("Blue : but " + matched_digits + " did not match with list " + matchList); 149 | } 150 | clickcloseBtn(); 151 | } else { 152 | clickcloseBtn(); 153 | } 154 | time++; 155 | } else { clearInterval(interval); } 156 | }, 1000); 157 | } 158 | } 159 | 160 | function clickcloseBtn() { 161 | try{ 162 | if (document.getElementByXPath("//*[@id='contract_confirmation_container' and contains(@style, 'none')]") == null){ 163 | document.getElementById('contract_confirmation_container').click(); 164 | document.getElementById('close_confirmation_container').click(); 165 | } 166 | } catch(err) {} 167 | } 168 | 169 | function clickHigherPurchaseBtn(){ 170 | try{ 171 | document.getElementById('purchase_button_top').click(); 172 | } catch(err) {} 173 | } 174 | 175 | 176 | function ButtonClickAction(zEvent) { 177 | GM_setValue("matchList", ""); 178 | var matchList = prompt('To update your matching numbers list, enter last 3 digits comma separated. For example 2.40,2.80,1.02,8.40 etc...', ''); 179 | if (matchList) { 180 | GM_setValue("matchList", matchList); 181 | console.log("Stored matchList : " + matchList); 182 | GM_setValue("UserCancelledPrompt", false); 183 | // reload 184 | self.location.assign(location); 185 | } 186 | else { 187 | GM_setValue("UserCancelledPrompt", true); 188 | console.log("User Cancelled prompt to update matchList."); 189 | } 190 | } 191 | 192 | function AddButton() { 193 | // Add a button element on div 194 | var zNode = document.createElement('div'); 195 | zNode.innerHTML = ''; 196 | zNode.setAttribute('id', 'myContainer'); 197 | document.body.appendChild(zNode); 198 | 199 | //--- Activate the newly added button. 200 | document.getElementById("myButton").addEventListener("click", ButtonClickAction, false); 201 | 202 | //--- Style our newly added element using CSS. 203 | GM_addStyle(` 204 | #myContainer{position:fixed;bottom:30px;left:0;font-size:10px;margin:0;opacity:.75}#myButton{cursor:pointer;background-color:lightgrey;color:black} 205 | #myButton:hover{background-color:#555;color:white;box-shadow:0 2px 6px 0 rgba(0,0,0,.24),0 5px 10px 0 rgba(0,0,0,.19);opacity:1} 206 | `); 207 | 208 | } 209 | 210 | 211 | (async function() { 212 | 213 | sleepFunc(); 214 | document.onreadystatechange = function () { 215 | if (document.readyState == "complete") { 216 | sleepFunc(); 217 | AddButton(); 218 | console.clear(); 219 | waitForKeyElements("span.market", mainMethod); 220 | }; 221 | } 222 | 223 | 224 | })(); 225 | -------------------------------------------------------------------------------- /Esty UK Product Data.user.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name Etsy UK Product data 3 | // @namespace http://tampermonkey.net/ 4 | // @version 0.1 5 | // @description Download product info from etsy 6 | // @author Kowshika 7 | // @match https://www.etsy.com/uk/listing 8 | // @match https://www.etsy.com/uk/listing/* 9 | // @match https://www.etsy.com/uk/shop/ 10 | // @match https://www.etsy.com/uk/shop/* 11 | // @include https://www.etsy.com/uk/listing* 12 | // @runat document-end 13 | // @grant none 14 | 15 | // ==/UserScript== 16 | 17 | function has(String, search) { try { if (String.indexOf(search) > -1) { return true; } } catch (err) {} return false; } 18 | 19 | 20 | function waitForElementToDisplay(selector, time) { 21 | if(document.querySelector(selector) != null) { 22 | console.log(selector + ' found'); 23 | return; 24 | } 25 | else { 26 | setTimeout(function() { 27 | waitForElementToDisplay(selector, time); 28 | }, time); 29 | } 30 | } 31 | 32 | 33 | (function() { 34 | 35 | var textData = ""; 36 | 37 | function saveText(filename, text) { 38 | var tempElem = document.createElement('a'); 39 | tempElem.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); 40 | tempElem.setAttribute('download', filename); 41 | tempElem.click(); 42 | console.log(filename + ' File downloaded'); 43 | } 44 | 45 | function sleep(ms) { return new Promise(res => setTimeout(res, ms)); }; 46 | let sleepFunc = async function() { await sleep(3000); }; 47 | 48 | document.getElementByXPath = function(sValue) { var a = this.evaluate(sValue, this, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); if (a.snapshotLength > 0) { return a.snapshotItem(0); } }; 49 | sleepFunc(); 50 | document.onreadystatechange = function () { 51 | if (document.readyState == "complete") { 52 | waitForElementToDisplay('#content', 5000); 53 | waitForElementToDisplay('#collage-footer', 5000); 54 | 55 | $(window).on('load', function() { 56 | 57 | if (has(window.location.href, '/listing/')){ 58 | var a = document.querySelector('script[type="application/ld+json"]'); 59 | var obj = JSON.parse(a.text); 60 | var category = obj.category; 61 | var shopname = obj.brand; 62 | a = document.querySelector('meta[property="etsymarketplace:shop"]'); 63 | var shopurl = a.content; 64 | console.log(obj); 65 | 66 | textData += shopurl + " | " 67 | textData += shopname 68 | textData += " | " 69 | textData += shopurl 70 | textData += " | " 71 | textData += category 72 | textData += " | " 73 | textData += window.location.href.split("?")[0] + " | " 74 | 75 | if (textData.length > 10){ 76 | saveText("listingData.txt", textData); 77 | } else { 78 | console.log('No Data found.') 79 | } 80 | window.location.href = shopurl; 81 | } 82 | 83 | if (has(window.location.href, '/shop/')){ 84 | var owner = ""; var ownerurl = ""; var location = ""; 85 | try {owner = document.getElementByXPath("//h2[text()='Shop owner']//following::div[@data-editable-img='user-avatar']//a/p").textContent; } catch(err) { } 86 | try {ownerurl = document.getElementByXPath("//h2[text()='Shop owner']//following::div[@data-editable-img='user-avatar']//a").href; } catch(err) { } 87 | try {location = document.getElementByXPath("//*[@data-key='user_location']").textContent; } catch(err) { } 88 | 89 | console.log(owner); 90 | 91 | textData += window.location.href.split("?")[0] + " | " 92 | textData += owner 93 | textData += " | " 94 | textData += ownerurl 95 | textData += " | " 96 | textData += location 97 | textData += " | " 98 | 99 | if (textData.length > 10){ 100 | saveText("ShopData.txt", textData); 101 | } else { 102 | console.log('No Data found.') 103 | } 104 | } 105 | 106 | }); 107 | } 108 | } 109 | console.log('Page loaded'); 110 | 111 | 112 | 113 | })(); 114 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | -------------------------------------------------------------------------------- /Labor_NY_Stats.user.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name Labor NY Stats 3 | // @namespace http://tampermonkey.net/ 4 | // @description Scrape data from realtor site 5 | // @version 0.1 6 | // @author kowshika-n 7 | // @homepage https://github.com/kowshika1 8 | // @downloadURL https://github.com/kowshika1/WebScraping_Userscripts/raw/master/Labor_NY_Stats.user.js 9 | // @updateURL https://github.com/kowshika1/WebScraping_Userscripts/raw/master/Labor_NY_Stats.user.js 10 | // @match https://labor.ny.gov/stats/directb5.asp?id=* 11 | // @grant none 12 | // @runat document-end 13 | // ==/UserScript== 14 | 15 | function has(String, search) { try { if (String.indexOf(search) > -1) { return true; } } catch (err) {} return false; } 16 | 17 | 18 | function waitForElementToDisplay(selector, time) { 19 | if(document.querySelector(selector) != null) { 20 | console.log(selector + ' found'); 21 | return; 22 | } 23 | else { 24 | setTimeout(function() { 25 | waitForElementToDisplay(selector, time); 26 | }, time); 27 | } 28 | } 29 | 30 | 31 | (async function() { 32 | 'use strict'; 33 | var textData = ""; 34 | function sleep(ms) { return new Promise(res => setTimeout(res, ms)); }; 35 | let sleepFunc = async function() { await sleep(3000); }; 36 | 37 | document.getElementByXPath = function(sValue) { var a = this.evaluate(sValue, this, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); if (a.snapshotLength > 0) { return a.snapshotItem(0); } }; 38 | sleepFunc(); 39 | document.onreadystatechange = function () { 40 | if (document.readyState == "complete") { 41 | waitForElementToDisplay('.last-child', 3000); 42 | } 43 | } 44 | console.log('Page loaded'); 45 | 46 | 47 | function saveText(filename, text) { 48 | var tempElem = document.createElement('a'); 49 | tempElem.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); 50 | tempElem.setAttribute('download', filename); 51 | tempElem.click(); 52 | console.log(filename + ' File downloaded'); 53 | } 54 | 55 | textData = window.location.href + " | " 56 | textData += document.getElementByXPath("//*[contains(text(), 'Company Name')]//..//../td[last()]").textContent.trim(); 57 | textData += " | " 58 | textData += document.getElementByXPath("//*[contains(text(), 'Address')]//..//../td[last()]").textContent.trim(); 59 | textData += " | " 60 | textData += document.getElementByXPath("//*[contains(text(), 'Contact')]//..//../td[last()]").textContent.trim(); 61 | textData += " | " 62 | textData += document.getElementByXPath("//*[contains(text(), 'Phone')]//..//../td[last()]").textContent.trim(); 63 | textData += " | " 64 | textData += document.getElementByXPath("//*[contains(text(), 'URL')]//..//../td[last()]").textContent.trim(); 65 | textData += " | " 66 | textData += document.getElementByXPath("//*[contains(text(), 'Employment Range')]//..//../td[last()]").textContent.trim(); 67 | textData += " | " 68 | 69 | if (textData.length > 10){ 70 | saveText("BusinessDirectory.txt", textData); 71 | } else { 72 | console.log('No Data found.') 73 | } 74 | 75 | 76 | })(); 77 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WebScraping_Userscripts 2 | 3 | [![forthebadge](https://forthebadge.com/images/badges/made-with-javascript.svg)](https://kowshika-n.github.io/) 4 | 5 | [![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0) [![Upwork badge](https://img.shields.io/badge/HIRE_ME-Upwork-37A000.svg)](https://www.upwork.com/o/profiles/users/~01839791ddb1ede3fa/) [![Fiverr badge](https://img.shields.io/badge/HIRE_ME-Fiverr-1dbf73.svg)](https://www.fiverr.com/kowshikanagaraj/) 6 | 7 | A userscript is a program, usually written in JavaScript, for modifying web pages to augment browsing. 8 | 9 | This repo includes a collection of Javascript Userscripts to scrape and download data from multiple websites. This enables scraping from directories and paginated results. 10 | 11 | 12 | ### Requirements 13 | - Browsers : [Google Chrome](https://www.google.com/chrome/) or [Firefox](https://www.firefox.com/) or [Edge](https://www.microsoft.com/en-us/edge?form=MA13DE&OCID=MA13DE) 14 | - Browser Extension : [TamperMonkey](https://www.tampermonkey.net/) or [ViolentMonkey](https://violentmonkey.github.io/) 15 | - If you are new to userscripts, Checkout this [getting started guide](https://openuserjs.org/about/Userscript-Beginners-HOWTO) 16 | 17 | 18 | ### Hire me 19 | Looking for someone to automate a project at affordable rates? Get in [touch](https://www.upwork.com/o/profiles/users/~01839791ddb1ede3fa/) 20 | 21 | -------------------------------------------------------------------------------- /Realtor_Details.user.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name realtor details 3 | // @namespace http://tampermonkey.net/ 4 | // @description Scrape data from realtor site 5 | // @version 0.1 6 | // @author kowshika-n 7 | // @homepage https://github.com/kowshika1 8 | // @downloadURL https://github.com/kowshika1/WebScraping_Userscripts/raw/master/realtor_details.user.js 9 | // @updateURL https://github.com/kowshika1/WebScraping_Userscripts/raw/master/realtor_details.user.js 10 | // @include https://www.google.com/url?sa* 11 | // @include https://www.realtor.com/realestateandhomes-detail* 12 | // @include https://www.realtor.com/realestateandhomes-detail/* 13 | // @grant none 14 | // @runat document-end 15 | // ==/UserScript== 16 | 17 | function has(String, search) { try { if (String.indexOf(search) > -1) { return true; } } catch (err) {} return false; } 18 | 19 | 20 | function waitForElementToDisplay(selector, time) { 21 | if(document.querySelector(selector) != null) { 22 | console.log(selector + ' found'); 23 | return; 24 | } 25 | else { 26 | setTimeout(function() { 27 | waitForElementToDisplay(selector, time); 28 | }, time); 29 | } 30 | } 31 | 32 | 33 | (async function() { 34 | 'use strict'; 35 | 36 | var textData = ""; 37 | function sleep(ms) { return new Promise(res => setTimeout(res, ms)); }; 38 | let sleepFunc = async function() { await sleep(3000); }; 39 | 40 | document.getElementByXPath = function(sValue) { var a = this.evaluate(sValue, this, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); if (a.snapshotLength > 0) { return a.snapshotItem(0); } }; 41 | sleepFunc(); 42 | 43 | document.onreadystatechange = function () { 44 | if (document.readyState == "complete") { 45 | waitForElementToDisplay('.business-card-content', 3000); 46 | waitForElementToDisplay('.business-card-broker', 3000); 47 | } 48 | } 49 | console.log('Page loaded'); 50 | 51 | if (has(window.location.href, 'google.')){ 52 | document.getElementByXPath("//a[1]").click(); 53 | } 54 | 55 | if (document.getElementsByClassName('.business-card-broker').length >= 1){document.getElementsByClassName('.business-card-broker')[0].scrollIntoView(false)}; 56 | 57 | function saveText(filename, text) { 58 | var tempElem = document.createElement('a'); 59 | tempElem.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); 60 | tempElem.setAttribute('download', filename); 61 | tempElem.click(); 62 | console.log(filename + ' File downloaded'); 63 | } 64 | 65 | textData = window.location.href.split("?ex=")[0] + " | " 66 | textData += document.getElementByXPath("//*[contains(@class,'business-card-agent')]").textContent.replace(/\n/g, " ").trim() 67 | textData += " | " 68 | textData += document.getElementByXPath("//*[contains(@class,'business-card-broker')]").textContent.replace(/\n/g, " ").trim(); 69 | 70 | if (textData.length > 50){ 71 | saveText("realestateandhomes-detail.txt", textData); 72 | } else { 73 | console.log('No Data found.') 74 | } 75 | 76 | 77 | })(); 78 | -------------------------------------------------------------------------------- /Realtor_Search.user.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name realtor search 3 | // @namespace http://tampermonkey.net/ 4 | // @description Scrape data from realtor site 5 | // @version 0.1 6 | // @author kowshika-n 7 | // @homepage https://github.com/kowshika1 8 | // @downloadURL https://github.com/kowshika1/WebScraping_Userscripts/raw/master/realtor_search.user.js 9 | // @updateURL https://github.com/kowshika1/WebScraping_Userscripts/raw/master/realtor_search.user.js 10 | // @include https://www.realtor.com/realestateandhomes-search* 11 | // @include https://www.realtor.com/realestateandhomes-search/* 12 | // @grant none 13 | // @runat document-end 14 | // ==/UserScript== 15 | 16 | function has(String, search) { try { if (String.indexOf(search) > -1) { return true; } } catch (err) {} return false; } 17 | 18 | function Search(homeurls) { 19 | if (document.links.length >= 100 ) { 20 | for(var i = document.links.length; i --> 0;) { 21 | if(has(document.links[i].href, 'realestateandhomes-detail') && document.links[i].hostname === location.hostname) { 22 | var hreference = document.links[i].href; 23 | if (has(hreference, "?ex=")) { 24 | hreference = hreference.split("?ex=")[0]; 25 | } 26 | homeurls.push(hreference); 27 | } 28 | } 29 | } else { 30 | console.log('Found only less than 100 urls') 31 | } 32 | 33 | homeurls = Array.from(new Set(homeurls)); 34 | return homeurls; 35 | } 36 | 37 | function waitForElementToDisplay(selector, time) { 38 | if(document.querySelector(selector) != null) { 39 | console.log(selector + ' found'); 40 | return; 41 | } 42 | else { 43 | setTimeout(function() { 44 | waitForElementToDisplay(selector, time); 45 | }, time); 46 | } 47 | } 48 | 49 | 50 | (async function() { 51 | 'use strict'; 52 | 53 | var homeurls = []; 54 | function sleep(ms) { return new Promise(res => setTimeout(res, ms)); }; 55 | let sleepFunc = async function() { await sleep(3000); }; 56 | 57 | document.getElementByXPath = function(sValue) { var a = this.evaluate(sValue, this, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); if (a.snapshotLength > 0) { return a.snapshotItem(0); } }; 58 | sleepFunc(); 59 | 60 | document.onreadystatechange = function () { 61 | if (document.readyState == "complete") { 62 | waitForElementToDisplay('.component_property-card', 3000); 63 | waitForElementToDisplay('.rdc-global-footer', 3000); 64 | } 65 | } 66 | console.log('Page loaded'); 67 | 68 | if (document.getElementsByClassName('rdc-global-footer').length >= 1){document.getElementsByClassName('rdc-global-footer')[0].scrollIntoView(false)}; 69 | homeurls = Search(homeurls); 70 | if (document.getElementByXPath("//a[@title='Go to Next Page']") != null) { document.getElementByXPath("//a[@title='Go to Next Page']").scrollIntoView(false); }; 71 | 72 | 73 | 74 | var county = window.location.href.split("search/")[1]; 75 | var pg = '1'; 76 | if (has(window.location.href, 'pg-')) { 77 | pg = window.location.href.split("pg-")[1]; 78 | } 79 | 80 | var myStrText = JSON.stringify(homeurls, null, 4); 81 | function saveText(filename, text) { 82 | var tempElem = document.createElement('a'); 83 | tempElem.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); 84 | tempElem.setAttribute('download', filename); 85 | tempElem.click(); 86 | console.log(filename + ' File downloaded'); 87 | } 88 | 89 | if (myStrText.length > 10){ 90 | saveText(county +"_pg-" + pg + ".txt", myStrText); 91 | } else { 92 | console.log('No Data found.') 93 | } 94 | 95 | 96 | 97 | if (document.getElementByXPath("//a[@title='Go to Next Page']") != null) { 98 | document.getElementByXPath("//a[@title='Go to Next Page']").click(); 99 | waitForElementToDisplay('.component_property-card', 3000); 100 | 101 | if (has(window.location.href, 'pg-')) { 102 | window.location.href = window.location.href.replace(("pg-" + pg), "pg-" + (parseInt(pg, 10)+1).toString() ); 103 | } else { 104 | window.location.href = window.location.href + "/pg-2"; 105 | } 106 | } else { 107 | alert("Done.") 108 | } 109 | 110 | 111 | })(); 112 | -------------------------------------------------------------------------------- /Reddit Comments Scrape.user.js: -------------------------------------------------------------------------------- 1 | document.getElementByXPath = function(sValue) { 2 | var a = this.evaluate(sValue, this, null, XPathResult 3 | .ORDERED_NODE_SNAPSHOT_TYPE, null); 4 | if (a.snapshotLength > 0) { 5 | return a.snapshotItem(0); 6 | } 7 | }; 8 | 9 | document.getElementsByXPath = function(sValue) { 10 | var aResult = new Array(); 11 | var a = this.evaluate(sValue, this, null, XPathResult 12 | .ORDERED_NODE_SNAPSHOT_TYPE, null); 13 | for (var i = 0; i < a.snapshotLength; i++) { 14 | aResult.push(a.snapshotItem(i)); 15 | } 16 | return aResult; 17 | }; 18 | 19 | var comments = document.getElementsByXPath( 20 | "//div[contains(@class, 'entry')]//form//div[contains(@class, 'usertext')]" 21 | ); 22 | var taglines = document.getElementsByXPath( 23 | "(//div[contains(@class, 'entry')]//form//div[contains(@class, 'usertext-body')])//..//../p[@class='tagline']" 24 | ); 25 | var permalinks = document.getElementsByXPath( 26 | "(//div[contains(@class, 'entry')]//form//div[contains(@class, 'usertext-body')])//following::a[text() = 'permalink']" 27 | ); 28 | var scores = document.getElementsByXPath( 29 | "(//div[contains(@class, 'entry')]//form//div[contains(@class, 'usertext-body')])//..//../p[@class='tagline']/span[contains(@class,'score unvoted')]" 30 | ); 31 | 32 | 33 | function saveText(filename, text) { 34 | var tempElem = document.createElement('a'); 35 | tempElem.setAttribute('href', 'data:text/plain;charset=utf-8,' + 36 | encodeURIComponent(text)); 37 | tempElem.setAttribute('download', filename); 38 | tempElem.click(); 39 | console.log(filename + ' File downloaded'); 40 | } 41 | 42 | var textData = ""; 43 | for (var i = 0; i < permalinks.length; i++) { 44 | textData += taglines[i].children[1].href + " | " + permalinks[i].href + 45 | " | " + scores[i].textContent.split(" ")[0] + " | " + comments[i] 46 | .textContent.trim() + " | " + "\n\n"; 47 | console.log(textData); 48 | } 49 | 50 | if (textData.length > 10) { 51 | saveText("Reddit.txt", textData) 52 | } 53 | -------------------------------------------------------------------------------- /Startup_Village.user.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name Startup Village 3 | // @namespace http://tampermonkey.net/ 4 | // @description Scrape data from startup village 5 | // @version 0.1 6 | // @author kowshika-n 7 | // @homepage https://github.com/kowshika1 8 | // @downloadURL https://github.com/kowshika1/WebScraping_Userscripts/raw/master/Startup_Village.user.js 9 | // @updateURL https://github.com/kowshika1/WebScraping_Userscripts/raw/master/Startup_Village.user.js 10 | // @match https://startupvillage.ru/* 11 | // @include https://startupvillage.ru/* 12 | // @grant none 13 | //@run-at document-end 14 | // ==/UserScript== 15 | 16 | function saveText(filename, text) { 17 | var tempElem = document.createElement('a'); 18 | tempElem.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); 19 | tempElem.setAttribute('download', filename); 20 | tempElem.click(); 21 | console.log(filename + ' File downloaded'); 22 | } 23 | 24 | 25 | (function() { 26 | 'use strict'; 27 | var textData = ""; 28 | var i; 29 | document.getElementsByXPath = function(sValue){ var aResult = new Array();var a = this.evaluate(sValue, this, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);for ( var i = 0 ; i < a.snapshotLength ; i++ ){aResult.push(a.snapshotItem(i));}return aResult;}; 30 | var filename = document.getElementsByXPath("//*[contains(@for, 'industry')]//..//option[@selected='selected']")[0].textContent.trim(); 31 | if (filename == null || filename == "") {filename = "NoIndustry"} 32 | 33 | for (i = 0; i < document.getElementsByXPath('//*[@class="d-block"]').length; i+=2){ 34 | textData += (document.getElementsByXPath('//*[@class="d-block"]')[i].textContent.trim() + "," + document.getElementsByXPath('//*[@class="d-block"]')[i+1].textContent.trim()) + "\n"; 35 | } 36 | for (i = 0; i < document.getElementsByXPath('//*[contains(@class, "participants-item-position")]').length; i++){ 37 | textData += (document.getElementsByXPath('//*[contains(@class, "participants-item-position")]')[i].textContent.trim()) + "\n"; 38 | } 39 | 40 | if (textData.length > 10){ 41 | saveText((filename + ".txt"), textData); 42 | } else { 43 | console.log('No Data found.') 44 | } 45 | 46 | })(); 47 | -------------------------------------------------------------------------------- /YouTube View Counter.user.js: -------------------------------------------------------------------------------- 1 | function has(a, b) { 2 | try { 3 | if (a.indexOf(b) > -1) { 4 | return true 5 | } 6 | } catch (c) {} 7 | return false 8 | } 9 | document.getElementByXPath = function(c) { 10 | var b = this.evaluate(c, this, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); 11 | if (b.snapshotLength > 0) { 12 | return b.snapshotItem(0) 13 | } 14 | }; 15 | document.getElementsByXPath = function(e) { 16 | var d = new Array(); 17 | var b = this.evaluate(e, this, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); 18 | for (var c = 0; c < b.snapshotLength; c++) { 19 | d.push(b.snapshotItem(c)) 20 | } 21 | return d 22 | }; 23 | 24 | function waitForElementToDisplay(a, b) { 25 | if (document.querySelector(a) != null) { 26 | console.log(a + " found"); 27 | return 28 | } else { 29 | setTimeout(function() { 30 | waitForElementToDisplay(a, b) 31 | }, b) 32 | } 33 | } 34 | 35 | function waitForElementToDisplayWithXpath(a, b) { 36 | if (document.getElementByXPath(a) != null) { 37 | console.log(a + " found"); 38 | return 39 | } else { 40 | setTimeout(function() { 41 | waitForElementToDisplayWithXpath(a, b) 42 | }, b) 43 | } 44 | }; 45 | 46 | function getVal(e) { 47 | return multiplier = e.substr(-1).toLowerCase(), "k" == multiplier ? 1e3 * parseFloat(e) : "m" == multiplier ? 1e6 * parseFloat(e) : void 0 48 | } 49 | 50 | //*[@id='metadata-line']//*[contains(text(), 'views')] 51 | a = document.getElementsByXPath("//*[@id='metadata-line']//*[contains(text(), 'views')]") 52 | for (var i = 0; i < a.length; i++) { 53 | console.log(getVal(a[i].textContent.replace(' views', '')), 54 | document.getElementByXPath("(//a[@id='video-title' and contains(@href, 'watch?')])[" + (i + 1).toString() + "]").href) 55 | } 56 | --------------------------------------------------------------------------------