示例#1
0
def extract_publisher_data(post):
    """
	Extracts publisher data from js

	Returns
	-------

	id_urbania: string
	id_publisher: string
	"""
    script = post.find_all("script")

    id_urbania_pattern = re.compile(r"'idAviso'\s*:\s*(.*?),")
    id_urbania = common.search_pattern(id_urbania_pattern, script)

    id_publisher_pattern = re.compile(r"'postingCode'\s*:\s*(.*?),")
    id_publisher = common.search_pattern(id_publisher_pattern, script)

    return id_urbania, id_publisher
示例#2
0
def extract_location_id(post):
    """
	Extracts the location id info from js

	Returns
	-------
	province_id: string
	city_id: string
	neighborhood_id: string
	"""
    script = post.find_all("script")
    prov_id_patt = re.compile(r"'provinceId'\s*:\s*(.*?),")
    city_id_patt = re.compile(r"'cityId'\s*:\s*(.*?),")
    neig_id_patt = re.compile(r"'neighborhoodId'\s*:\s*(.*?),")

    prov_id = common.search_pattern(prov_id_patt, script)
    city_id = common.search_pattern(city_id_patt, script)
    neig_id = common.search_pattern(neig_id_patt, script)

    return prov_id, city_id, neig_id
示例#3
0
def extract_rental_price(post):
    """
	Extracts rental price data from js

	Returns
	-------
	rental_price: string
	"""
    script = post.find_all("script")
    price_pattern = re.compile(r"'rentalPrice'\s*:\s*(.*\d?),")
    price = common.search_pattern(price_pattern, script)

    return price
示例#4
0
def extract_property(post):
    """
	Extracts property type from js

	Returns
	-------
	property: string
	"""
    script = post.find_all("script")
    property_pattern = re.compile(r"'propertyType'\s*:\s*(.*?),")
    property_ = common.search_pattern(property_pattern, script)

    return property_
示例#5
0
def extract_description(post):
    """
	Extracts the description from js
	
	Returns
	-------
	description: string
	"""
    script = post.find_all("script")
    desc_pattern = re.compile(r"'description'\s*:\s*\"(.*?)\",")
    desc = common.search_pattern(desc_pattern, script)

    return desc
示例#6
0
def extract_operation(post):
    """
	Extracts operation type from js

	Returns
	-------
	operation: string
	"""
    script = post.find_all("script")
    operation_pattern = re.compile(r"'operationType'\s*:\s*(.*?),")
    operation = common.search_pattern(operation_pattern, script)

    return operation
示例#7
0
def extract_location(post):
    """
	Extracts the location info from js

	Returns
	-------
	province: string
	city: string
	neighborhood: string
	address: string
	"""
    script = post.find_all("script")
    province_pattern = re.compile(r"'province'\s*:\s*(.*?),")
    city_pattern = re.compile(r"'city'\s*:\s*(.*?),")
    neighborhood_pattern = re.compile(r"'neighborhood'\s*:\s*(.*?),")
    address_pattern = re.compile(r"'address'\s*:\s*{\"name\":\"(.*?)\",")

    province = common.search_pattern(province_pattern, script)
    city = common.search_pattern(city_pattern, script)
    neighborhood = common.search_pattern(neighborhood_pattern, script)
    address = common.search_pattern(address_pattern, script)

    return province, city, neighborhood, address
示例#8
0
def extract_general_features(post):
    """
	Extracts the general features from js

	Returns
	-------
	features: string 
	"""
    script = post.find_all("script")
    feature_pattern = re.compile(r"'generalFeatures'\s*:\s*({.*\d?}),")
    feature = common.search_pattern(feature_pattern, script)

    if feature == "":
        feature = "{}"

    return feature
示例#9
0
 def get_seller_status(self, script):
     return common.search_pattern(self.patt["seller_status"], script)
示例#10
0
 def get_available_stock(self, script):
     return common.search_pattern(self.patt["available_stock"], script)
示例#11
0
 def get_sold_stock(self, script):
     return common.search_pattern(self.patt["sold_stock"], script)
示例#12
0
 def get_sales_completed(self, script):
     return common.search_pattern(self.patt["sales_completed"], script)
示例#13
0
 def get_seller_age(self, script):
     return common.search_pattern(self.patt["seller_age"], script)
示例#14
0
 def get_local_item_price(self, script):
     return common.search_pattern(self.patt["local_item_price"], script)
示例#15
0
 def get_reputation_level(self, script):
     return common.search_pattern(self.patt["reputation_level"], script)
示例#16
0
 def get_path_to_root(self, script):
     return common.search_pattern(self.patt["path_to_root"], script)
示例#17
0
 def get_root_category(self, script):
     return common.search_pattern(self.patt["root_category"], script)
示例#18
0
 def get_condition_item(self, script):
     return common.search_pattern(self.patt["item_condition"], script)
示例#19
0
 def get_model_item(self, script):
     return common.search_pattern(self.patt["model"], script)
示例#20
0
 def get_brand_item(self, script):
     return common.search_pattern(self.patt["brand"], script)
示例#21
0
 def get_customer_satisfaction(self, script):
     return common.search_pattern(self.patt["customer_satisfaction"],
                                  script)
示例#22
0
 def get_item_id(self, script):
     return common.search_pattern(self.patt["item_id"], script)