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

z

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

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.22.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.22-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scrape-data-cleaner-0.0.22.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12

File hashes

Hashes for scrape-data-cleaner-0.0.22.tar.gz
Algorithm Hash digest
SHA256 fe8251627518e41eecfb068f872c2aa1c45ec54043c6da2e7ab78093f90ceca5
MD5 46cd80903c14c04cd3774cbe44059bcb
BLAKE2b-256 b0ad5678cc75a393628c6ff25e0b0204bae7d751a93246754369191a9651ffe0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: scrape_data_cleaner-0.0.22-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12

File hashes

Hashes for scrape_data_cleaner-0.0.22-py3-none-any.whl
Algorithm Hash digest
SHA256 64464d37fa45325ada31ef8e2d37c92ff0d61720e30bc2de9b458d877a2183bb
MD5 1304a81b709fa51a4bc39c4bdba71167
BLAKE2b-256 ffb8e4e8366c839c2b3f9e1e98888e85c2c2231d080cafa7b6b9c3e6987ef074

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