Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Scrape Rightmove
import json
from bson import json_util # pip install pymongo
from datetime import datetime
from rightmove_webscraper import rightmove_data
class rightmove_list(list):
def __init__(self, rightmove_object_results):
new_list = []
for key in rightmove_object_results.keys():
if not new_list:
new_list = [{} for x in rightmove_object_results[key]]
for i, v in enumerate(rightmove_object_results[key]):
new_list[i][key] = self.__fix_datetime(v)
def __fix_datetime(self, val):
if isinstance(val,datetime):
return val.strftime('%Y-%m-%dT%H:%M:%S.%f')
return val
url = ""
rightmove_object = rightmove_data(url)
# print(rightmove_object.get_results.to_json())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment