Skip to main content

xl

Parsing google results

To install: pip install xl

Overview

The xl package is designed for parsing Google search results HTML pages. It provides a comprehensive set of tools to extract various pieces of information from Google search results, such as the number of results, ads, organic results, related searches, and more. The package utilizes BeautifulSoup for parsing HTML content and provides a structured output in the form of dictionaries that can be easily used for further data analysis or processing.

Main Features

  • Parsing Google Search Results: Extract detailed information from Google search result pages.
  • Support for Multiple Result Types: Handles organic results, ads, related searches, and other components found in Google search pages.
  • Output as Structured Data: Converts HTML content into structured dictionaries, making it easier to handle and analyze.
  • Utility Functions: Includes several utility functions to assist with tasks such as file handling and URL processing.

Installation

To install the package, run the following command:

pip install xl

Usage Examples

Parsing a Google Search Result HTML File

To parse a Google search result from an HTML file and extract information:

from xl import mk_gresult_tag_dict, parse_tag_dict

# Path to your HTML file
file_path = 'path_to_your_google_search_result.html'

# Create a tag dictionary from the HTML file
tag_dict = mk_gresult_tag_dict(file_path)

# Parse the tag dictionary to get a structured information dictionary
info_dict = parse_tag_dict(tag_dict)

# Print the extracted information
print(info_dict)

Extracting Domain Lists from Google Results

To get a list of domains from the parsed Google search results:

from xl import get_domain_list_from_google_results

# Assuming `info_dict` is already obtained from previous steps
domain_list = get_domain_list_from_google_results(info_dict)

# Print the list of domains
print(domain_list)

Function Documentation

mk_gresult_tag_dict(input)

Takes a BeautifulSoup object, HTML string, or filename of a Google result HTML and returns a dictionary containing key components of interest from the HTML.

parse_tag_dict(tag_dict)

Takes a dictionary (generated by mk_gresult_tag_dict) and parses it to extract structured information such as the number of results, lists of ads, and organic results.

get_domain_list_from_google_results(gresults)

Accepts either a BeautifulSoup object, HTML content, or a filename and returns a list of domains extracted from the Google search results.

Contributing

Contributions to the xl package are welcome. Please ensure that your code adheres to the existing style and that all tests pass before submitting a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for xl 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xl 0.0.6
File Size Uploaded
xl-0.0.6.tar.gz 12.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xl 0.0.6
File Interpreter ABI Platform
xl-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 23.7 kB

Release files / xl-0.0.6.tar.gz

Download URL xl-0.0.6.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0e9b13705d9eacf56ed0038f20e5e662b7fd53e5990543bbaf00e79f86a3cd17
BLAKE2b-256 checksum
How to use checksums
2f578038f3c5e27acdcdff10fa44427707b8fc43d57d014a3e59a23c05d20b76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / xl-0.0.6-py3-none-any.whl

Download URL xl-0.0.6-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f89f4aa4d14a3ed96a5de0cd1fb67e821a949ab796e0288215f3e4c9df7e833
BLAKE2b-256 checksum
How to use checksums
71c04ef94a08da0bef7207a1081ff8ab49af78991cd9bf988fa2938a58ba86a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page