-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
35 lines (26 loc) · 883 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from bs4 import BeautifulSoup
import requests
from PIL import Image
import os
import lxml
from lxml import etree
import pandas as pd
import numpy as np
from html.parser import HTMLParser
class properties():
def __init__(self, mls_link):
self.mls_link = mls_link
# self.listing_div = None
self._collect_listings()
def _collect_listings(self):
response = requests.get(self.mls_link)
html = response.text
html_soup = BeautifulSoup(html, features='html.parser')
self.listing_div = html_soup.find_all('div', attrs={'class': 'j-resultsPageAsyncDisplays'})
def convert_to_HTML(self):
self.p = HTMLParser()
self.p.feed(str(self.listing_div))
self.p.close()
if __name__ == "__main__":
mls_link = os.environ['MLS_FEED_URL']
northern_denver_properties = properties(mls_link)