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.

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

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.21.tar.gz (5.7 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.21-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scrape-data-cleaner-0.0.21.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.7.11

File hashes

Hashes for scrape-data-cleaner-0.0.21.tar.gz
Algorithm Hash digest
SHA256 95d90de07af7bad13dd1828e153f681d45f7c519770d25683dc4f9d105f981ea
MD5 693f11d58bce717ee0c3745ce7fda58d
BLAKE2b-256 6c0e43e31e97a5e7faa0e7da47443bab25ea12c75d9baaac1e3a363c9cab03ca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: scrape_data_cleaner-0.0.21-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.7.11

File hashes

Hashes for scrape_data_cleaner-0.0.21-py3-none-any.whl
Algorithm Hash digest
SHA256 b893aced4260990551a5cbaa4b36d8724e04be16e0005819e16dcc531d514f37
MD5 0b5f96f12f5a8b481c116f1999129f3c
BLAKE2b-256 f240502565970b6574025423b820de07d4d2edff42f6c7c591007ad945fd7603

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