Skip to main content

A package for cleaning forms of scraped data and convert them to normal text.

Project description

Scrape Data Cleaner

Clean scraped data fields to recieve your disired text without unicodes,spaces and other unessesary quirks.

Installation

pip install scrape-data-cleaner

Basic Usage

from cleaner import string_cleaner,price_cleaner,remove_char
print(string_cleaner('Iphone 8   plus \  '))
print(price_cleaner(remove_char('USD 100')))

Modules

string_cleaner :

Cleans strings strings encode and re-encode them in ASCII

string_cleaner_array :

Takes an array of strings encode and re-encode them in ASCII then return an array.

string_cleaner_array_wine:

Takes an array of strings encode and re-encode them in ASCII then return an array however during cleaning does not force removing of spaces and tabs.

price_cleaner:

Performs string cleaning from string_cleaner then converts the response to Integer.

get_price:

Extracts price from a rouge string then converts the response to Integer.

i.e string="\a \t rr$12.5" outputs 12

remove_special_char :

Removes special characters from string i.e. * - & e.t.c.

remove_char:

Removes all characters and leaves out only integers.

remove_char_special:

Removes all characters and leaves out only integers but first checks for .00 and replaces that with nothing to avoid getting price with extra 00.

cleanhtml:

Extracts text from HTML and returns a string.

cleanhtml_array:

Extracts text from an array of HTML and returns an array of strings.

cleanhtml_array2:

Extracts text from an array of HTML and returns an array of strings however does string_cleaner for each string.

nbsp_replacer:

Replaces unicode \u00a0 with a space.

ratings_extractor:

Extracts ratings from style for stars. Takes style of this format width:80% and converts that to a rating of 1 to 5.

specs_table_gen:

Takes two arrays and combine them with : return one array.

space_tabs_remover:

Removes spaces and tabs i.e if there is \u,\r ,\n . This is more aggressive.

extract_list:

Extracts text in HTML listlifrom a HTML block. Takes raw HTML and returns an array of strings.

gen_link2:

Receives two strings name of store and the link then creates a custom url

i.e

gen_link2('amazon','https://amazon/product/iphone-7.html')

Results: /amazon/iphone-7

simple_split:

Receives two strings name of store and the link then creates a custom url

i.e

simple_split('amazon','/iphone-7/product')

Results: /amazon/iphone-7__product

extract_from_ldjson:

Extract a value from ld/json. i.e extract_from_ldjson(ld_json,'name') will extract the name value in the ld/json.

table_shaker:

Only works if your using scrapy. Takes the HTML block with the table and an array of the types of data in table. i.e table_shaker(response.css('table'),['td','td']).

Note: Array can be ['th','td'],['th','th'] depending on the table.

get_description :

Extracts description from HTML and returns an array with dictionaries with keys of either text or title. Takes Raw HTML.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scrape-data-cleaner-0.0.25.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scrape_data_cleaner-0.0.25-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file scrape-data-cleaner-0.0.25.tar.gz.

File metadata

  • Download URL: scrape-data-cleaner-0.0.25.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.17

File hashes

Hashes for scrape-data-cleaner-0.0.25.tar.gz
Algorithm Hash digest
SHA256 493f28355cd8c73a2561acaafbafdeccd37f8dcea9a8c07d7cb74908be3899d3
MD5 7d7ebc927268f0cee709d0219378dad1
BLAKE2b-256 13ce3b507e47cc342d030a79690628fa8e6d2b44e859dd07b42efbe38b0b2555

See more details on using hashes here.

File details

Details for the file scrape_data_cleaner-0.0.25-py3-none-any.whl.

File metadata

File hashes

Hashes for scrape_data_cleaner-0.0.25-py3-none-any.whl
Algorithm Hash digest
SHA256 47f95b4f35915529252032a38938aa465fa09e7f35628eb114fbfb9a3566f79f
MD5 f98e5970bea69bc831730dafaa3c1cc0
BLAKE2b-256 30628e5e6d620b83cd0f90b2e5e17e21de5071bc76e63a835070f9c099b89359

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page