Guest User

redfin property info grabber

a guest
Apr 13th, 2022
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Property Grabber
  3. // @namespace    http://redfin.property.grabber.com
  4. // @version      0.1
  5. // @description  Copy essential property info from Redfin
  6. // @author       You
  7. // @match        https://www.redfin.com/*
  8. // @require      https://code.jquery.com/jquery-2.1.4.min.js
  9. // @icon         https://www.google.com/s2/favicons?domain=hibbard.eu
  10. // @grant        none
  11. // ==/UserScript==
  12.  
  13. // Note that the button to copy the property info is at the bottom right of the page, you need to wait for the page to load
  14. // completely before it appears. Sometimes it doesn't appear at all for some reason, just refresh the page and it should.
  15.  
  16. 'use strict';
  17. var $ = window.$;
  18.  
  19. $(window).load(function() {
  20.     $('body').append('<input type="button" value="Copy Info" id="CP">')
  21.     $("#CP").css("position", "fixed").css("bottom", 0).css("right", 0).css("color", "black");
  22.     $('#CP').click(function(){
  23.         // var moves = $('.move');
  24.         console.log("Grabbing property info")
  25.         var url = window.location.href;
  26.  
  27.         // Info from title at top below pictures
  28.         const addr = $('.street-address').attr('title') + ', ' + $('.homeAddress .dp-subtext').html().replace(/<!-- -->/g,'')
  29.         const price = $('[data-rf-test-id=abp-price]').find('.statsValue').html()
  30.         const sqft = $('[data-rf-test-id=abp-sqFt]').find('.statsValue').html()
  31.         const beds = $('[data-rf-test-id=abp-beds]').find('.statsValue').html()
  32.         const baths = $('[data-rf-test-id=abp-baths]').find('.statsValue').html()
  33.  
  34.         // Grab details from table and store in key-val pair; Some propery may not have HOA Dues, so can't hard code
  35.         var det = {}
  36.         const wanted = ['Year Built', 'Lot Size', 'MLS#', 'HOA Dues']
  37.         const details = $('.keyDetailsList:first').find('.header').filter(function(){return wanted.includes($(this).html())})
  38.         details.each(function() { det[$(this).html()] = $(this).siblings().html() })
  39.         //const year = $(details[0]).siblings().html()
  40.         //const lotSize = $(details[1]).siblings().html()
  41.         //const mls = $(details[2]).siblings().html()
  42.  
  43.  
  44.         // Payment calculator section info
  45.         const monthlyTax = $('.CalculatorSummary .colorBarLegend div:nth-child(2) span.Row--content').html() // seems like tax is always the 2nd one?
  46.         const insurance = $('.CalculatorSummary .colorBarLegend div:last-child span.Row--content').html() // sometimes HOA fees are also in there
  47.  
  48.         // Tax Table (this doesn't work unless user scroll down to tax table and clicks the Tax History)
  49.         //const tax = $('.TaxHistoryTable tr:nth-child(2) td:nth-child(2)').html()
  50.  
  51.         var info = [url, det['MLS#'], addr, det['Year Built'], beds, baths, det['Lot Size'], sqft, det['HOA Dues'], insurance, monthlyTax, price]
  52.         info = info.join('\r\n')
  53.         console.log(info)
  54.         navigator.clipboard.writeText(info); // copy to clipboard
  55.     });
  56. });
  57.  
  58.  
  59.  
  60.  
Add Comment
Please, Sign In to add comment