semvec/pypi-packages huggingface dataset:
xl 0.0.5
Parsing google results
License: apache-2.0

# 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:
```bash
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:
```python
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:
```python
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.
eu 0.0.9
It's good practice to write code that can be run as is on someone elses computer (or server).
License: apache-2.0

# eu

It's good practice to write code that can be run as is on someone else's computer (or server).

To install:	```pip install eu```

## Description

The `eu` package provides a practical example of how to dynamically determine and use absolute file paths in a Python script, which is crucial for ensuring that the code is portable and can run on different machines without modification. This approach avoids the pitfalls of hard-coded absolute paths, which can lead to errors when the code is run in different environments.

The main functionality demonstrated in the `__init__.py` file includes:
- Determining the absolute path of the current file (`__file__`).
- Finding the directory containing the current file using `os.path.dirname`.
- Constructing an absolute path from a relative path, ensuring that file references remain valid regardless of the current working directory.

This functionality is essential for applications that need to access files relative to the script's location, such as configuration files, data files, or other resources.

## Usage

### Determining File Paths

To use the functionality provided by the `eu` package, you can follow these steps:

1. Ensure that the file you want to reference is in the same directory as your script or specify the correct relative path.
2. Import the package to automatically execute the code that determines the paths.

Example:
```python
import eu  # This will execute the path setup code in __init__.py

# Now you can safely use `eu.absolute_path_from_relative_path` to access files
with open(eu.absolute_path_from_relative_path, 'r') as file:
    content = file.read()
    print(content)
```

This example assumes that there is a file named `hello_relative_world.txt` in the same directory as your script. The script reads the content of this file and prints it.

### Checking Current and Script Directories

The package also prints out the current working directory and the directory containing the script. This can be useful for debugging or when you need to understand where your Python environment is operating.

## Documentation

- `current_file_absolute_path`: A string containing the absolute path to the current Python file (`__file__`).
- `containing_folder`: A string containing the absolute path to the directory that contains the current Python file.
- `relative_path`: A string specifying a relative path to a file from the script's directory.
- `absolute_path_from_relative_path`: A string containing the absolute path constructed from the `containing_folder` and `relative_path`.

These variables are set up when the package is imported and are available for use in your scripts to handle file paths dynamically.