(self, html, source_url=None)
return extracted
Extracts contents from an HTML document.

            >>> from extraction import Extractor
            >>> import requests
            >>> html = requests.get("http://lethain.com/").text
            >>> extracted = Extractor().extract(html)
            >>> print extracted

        `source_url` is optional, but allows for a certain level of
        cleanup to be performed, such as converting relative URLs
        into absolute URLs and such.
Extracts contents from an HTML document.
Extracts contents from an HTML document .
def extract(self, html, source_url=None):
        """
        Extracts contents from an HTML document.

            >>> from extraction import Extractor
            >>> import requests
            >>> html = requests.get("http://lethain.com/").text
            >>> extracted = Extractor().extract(html)
            >>> print extracted

        `source_url` is optional, but allows for a certain level of
        cleanup to be performed, such as converting relative URLs
        into absolute URLs and such.
        """
        extracted = {}
        for technique in self.techniques:
            technique_extracted = self.run_technique(technique, html)
            technique_cleaned = self.cleanup(technique_extracted, source_url=source_url, technique=technique)
            for data_type, data_values in technique_cleaned.items():
                if data_values:
                    if data_type not in extracted:
                        extracted[data_type] = []

                    # don't include duplicate values
                    unique_data_values = [x for x in data_values if x not in extracted[data_type]]
                    extracted[data_type] += unique_data_values
        return extracted
def extract ( self , html , source_url = None ) : extracted = { } for technique in self . techniques : technique_extracted = self . run_technique ( technique , html ) technique_cleaned = self . cleanup ( technique_extracted , source_url = source_url , technique = technique ) for data_type , data_values in technique_cleaned . items ( ) : if data_values : if data_type not in extracted : extracted [ data_type ] = [ ] # don't include duplicate values unique_data_values = [ x for x in data_values if x not in extracted [ data_type ] ] extracted [ data_type ] += unique_data_values return extracted