# googlespy - Python Google Search Package
`googlespy` is a powerful Python package that allows you to easily perform Google searches and retrieve filtered search results based on various parameters such as file type, keywords, domains, language, and more. It's designed to be flexible and easy to use, enabling developers to integrate Google search results into their Python applications with minimal setup.
## Installation
To install `googlespy`, simply use the following pip command:
```bash
pip install googlespy
```
This will download and install the package along with all its dependencies. After installation, you can start using it in your Python scripts.
## Usage
### Basic Search
To perform a simple Google search, use the `search()` function with a query string. You can also limit the number of results and apply additional filters.
```python
from googlespy import search
results = search(
query="Python tutorial",
limit=10,
file_type=None,
keyword=None,
domain=None
)
for link in results:
print("result:", link)
```
This will search Google for "Python tutorial" and display up to 10 results.
### Search with File Type Filter
You can filter search results by file type. For example, if you want to find only PDF files related to Python tutorials:
```python
from googlespy import search
results = search(
query="Python tutorial",
limit=10,
file_type="pdf"
)
for link in results:
print("result:", link)
```
This will only return results that are PDF files.
### Search with Language Filter
To filter results based on the language of the content, use the `lang` parameter. For example, to search for Python tutorials in French:
```python
from googlespy import search
results = search(
query="Python tutorial",
limit=10,
lang="fr"
)
for link in results:
print("result:", link)
```
This will return Python tutorial results in French.
### Search with Proxy
You can also use a proxy server for your searches by providing a `proxy` URL. This can be useful if you want to anonymize your searches or access results from a different geographical location:
```python
from googlespy import search
proxy = 'http://199.36.158.100:8080/'
results = search(
query="proxy test",
limit=100,
lang="en",
proxy=proxy,
ssl_verify=False
)
for link in results:
print("result:", link)
```
This will route the search requests through the specified proxy server.
### Search with Interval Between Requests
To avoid triggering rate limits or CAPTCHA challenges, you can specify an interval between search requests. This is especially useful if you need to perform multiple searches:
```python
from googlespy import search
results = search(
query="Python tutorial",
limit=10,
interval=5
)
for link in results:
print("result:", link)
```
This will introduce a 5-second delay between each search request.
### Advanced Search
For more advanced filtering, you can enable the `advanced` parameter, which will apply additional filters and return more refined search results:
```python
from googlespy import search
results = search(
query="Python tutorial",
limit=10,
advanced=True
)
for link in results:
print("result:", link)
```
This enables advanced filtering for more precise results.
### Search with Specific Limit
To limit the number of results returned by the search, use the `limit` parameter. For example, to get only 20 results:
```python
from googlespy import search
results = search(
query="Python tutorial",
limit=20
)
for link in results:
print("result:", link)
```
This will return exactly 20 search results.
### Search for Specific File Type
If you want to filter search results by file type, you can use the `file_type` parameter. For example, to find only PDF files related to Python tutorials:
```python
from googlespy import search
results = search(
query="Python tutorial",
limit=10,
file_type="pdf"
)
for link in results:
print("result:", link)
```
This will return only PDF files.
### Search with Skip Invalid Links
If you want to skip invalid links in the search results, set the `skip_invalid` parameter to `True`:
```python
from googlespy import search
results = search(
query="Python tutorial",
limit=10,
skip_invalid=True
)
for link in results:
print("result:", link)
```
This will filter out any invalid links that may appear in the search results.
### Full Example
Here’s a full example demonstrating multiple filters applied together:
```python
from googlespy import search
results = search(
query="Google",
limit=10,
file_type="pdf",
lang="en",
interval=3,
proxy="http://199.36.158.100:8080",
advanced=True
)
for link in results:
print("result:", link)
```
This example performs a Google search for "Google" with several filters, including file type, keyword, domain, and more.
## License
MIT License. See the LICENSE file for details.
Raw data
{
"_id": null,
"home_page": "https://mrfidal.in/py/package/googlespy",
"name": "googlespy",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "mrfidal, fidal palamparambil, google, search, scraping, web scraping, python, googlesearch, api, filtered links, alpha",
"author": "Fidal",
"author_email": "mrfidal@proton.me",
"download_url": "https://files.pythonhosted.org/packages/2f/3c/0756e12c164df7fa0e1318dacf20d1b8521cf26604fb7965c4d72c9ab502/googlespy-1.1.1.tar.gz",
"platform": null,
"description": "# googlespy - Python Google Search Package\r\n\r\n`googlespy` is a powerful Python package that allows you to easily perform Google searches and retrieve filtered search results based on various parameters such as file type, keywords, domains, language, and more. It's designed to be flexible and easy to use, enabling developers to integrate Google search results into their Python applications with minimal setup.\r\n\r\n## Installation\r\n\r\nTo install `googlespy`, simply use the following pip command:\r\n\r\n```bash\r\npip install googlespy\r\n```\r\n\r\nThis will download and install the package along with all its dependencies. After installation, you can start using it in your Python scripts.\r\n\r\n## Usage\r\n\r\n### Basic Search\r\n\r\nTo perform a simple Google search, use the `search()` function with a query string. You can also limit the number of results and apply additional filters.\r\n\r\n```python\r\nfrom googlespy import search\r\n\r\nresults = search(\r\n query=\"Python tutorial\",\r\n limit=10,\r\n file_type=None,\r\n keyword=None,\r\n domain=None\r\n)\r\n\r\nfor link in results:\r\n print(\"result:\", link)\r\n```\r\n\r\nThis will search Google for \"Python tutorial\" and display up to 10 results.\r\n\r\n### Search with File Type Filter\r\n\r\nYou can filter search results by file type. For example, if you want to find only PDF files related to Python tutorials:\r\n\r\n```python\r\nfrom googlespy import search\r\n\r\nresults = search(\r\n query=\"Python tutorial\",\r\n limit=10,\r\n file_type=\"pdf\"\r\n)\r\n\r\nfor link in results:\r\n print(\"result:\", link)\r\n```\r\n\r\nThis will only return results that are PDF files.\r\n\r\n### Search with Language Filter\r\n\r\nTo filter results based on the language of the content, use the `lang` parameter. For example, to search for Python tutorials in French:\r\n\r\n```python\r\nfrom googlespy import search\r\n\r\nresults = search(\r\n query=\"Python tutorial\",\r\n limit=10,\r\n lang=\"fr\"\r\n)\r\n\r\nfor link in results:\r\n print(\"result:\", link)\r\n```\r\n\r\nThis will return Python tutorial results in French.\r\n\r\n### Search with Proxy\r\n\r\nYou can also use a proxy server for your searches by providing a `proxy` URL. This can be useful if you want to anonymize your searches or access results from a different geographical location:\r\n\r\n```python\r\nfrom googlespy import search\r\n\r\nproxy = 'http://199.36.158.100:8080/'\r\n\r\nresults = search(\r\n query=\"proxy test\",\r\n limit=100,\r\n lang=\"en\",\r\n proxy=proxy,\r\n ssl_verify=False\r\n)\r\n\r\nfor link in results:\r\n print(\"result:\", link)\r\n```\r\n\r\nThis will route the search requests through the specified proxy server.\r\n\r\n### Search with Interval Between Requests\r\n\r\nTo avoid triggering rate limits or CAPTCHA challenges, you can specify an interval between search requests. This is especially useful if you need to perform multiple searches:\r\n\r\n```python\r\nfrom googlespy import search\r\n\r\nresults = search(\r\n query=\"Python tutorial\",\r\n limit=10,\r\n interval=5\r\n)\r\n\r\nfor link in results:\r\n print(\"result:\", link)\r\n```\r\n\r\nThis will introduce a 5-second delay between each search request.\r\n\r\n### Advanced Search\r\n\r\nFor more advanced filtering, you can enable the `advanced` parameter, which will apply additional filters and return more refined search results:\r\n\r\n```python\r\nfrom googlespy import search\r\n\r\nresults = search(\r\n query=\"Python tutorial\",\r\n limit=10,\r\n advanced=True\r\n)\r\n\r\nfor link in results:\r\n print(\"result:\", link)\r\n```\r\n\r\nThis enables advanced filtering for more precise results.\r\n\r\n### Search with Specific Limit\r\n\r\nTo limit the number of results returned by the search, use the `limit` parameter. For example, to get only 20 results:\r\n\r\n```python\r\nfrom googlespy import search\r\n\r\nresults = search(\r\n query=\"Python tutorial\",\r\n limit=20\r\n)\r\n\r\nfor link in results:\r\n print(\"result:\", link)\r\n```\r\n\r\nThis will return exactly 20 search results.\r\n\r\n### Search for Specific File Type\r\n\r\nIf you want to filter search results by file type, you can use the `file_type` parameter. For example, to find only PDF files related to Python tutorials:\r\n\r\n```python\r\nfrom googlespy import search\r\n\r\nresults = search(\r\n query=\"Python tutorial\",\r\n limit=10,\r\n file_type=\"pdf\"\r\n)\r\n\r\nfor link in results:\r\n print(\"result:\", link)\r\n```\r\n\r\nThis will return only PDF files.\r\n\r\n### Search with Skip Invalid Links\r\n\r\nIf you want to skip invalid links in the search results, set the `skip_invalid` parameter to `True`:\r\n\r\n```python\r\nfrom googlespy import search\r\n\r\nresults = search(\r\n query=\"Python tutorial\",\r\n limit=10,\r\n skip_invalid=True\r\n)\r\n\r\nfor link in results:\r\n print(\"result:\", link)\r\n```\r\n\r\nThis will filter out any invalid links that may appear in the search results.\r\n\r\n### Full Example\r\n\r\nHere\u2019s a full example demonstrating multiple filters applied together:\r\n\r\n```python\r\nfrom googlespy import search\r\n\r\nresults = search(\r\n query=\"Google\",\r\n limit=10,\r\n file_type=\"pdf\",\r\n lang=\"en\",\r\n interval=3,\r\n proxy=\"http://199.36.158.100:8080\",\r\n advanced=True\r\n)\r\n\r\nfor link in results:\r\n print(\"result:\", link)\r\n```\r\n\r\nThis example performs a Google search for \"Google\" with several filters, including file type, keyword, domain, and more.\r\n\r\n## License\r\n\r\nMIT License. See the LICENSE file for details.\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python package to search Google and retrieve filtered links.",
"version": "1.1.1",
"project_urls": {
"Homepage": "https://mrfidal.in/py/package/googlespy"
},
"split_keywords": [
"mrfidal",
" fidal palamparambil",
" google",
" search",
" scraping",
" web scraping",
" python",
" googlesearch",
" api",
" filtered links",
" alpha"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4c7c5b9bba9a6bde62ef121b7aaecefd50e58a24d6ab1d2e6efaf7c187d95afd",
"md5": "34171b0c192d3688ad8169ebaf0c8181",
"sha256": "27dd6c6ef37849ed0287df66dbc47676145902ea18080bf5cd8787b1fe5fa953"
},
"downloads": -1,
"filename": "googlespy-1.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "34171b0c192d3688ad8169ebaf0c8181",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 4289,
"upload_time": "2024-11-22T07:45:56",
"upload_time_iso_8601": "2024-11-22T07:45:56.874136Z",
"url": "https://files.pythonhosted.org/packages/4c/7c/5b9bba9a6bde62ef121b7aaecefd50e58a24d6ab1d2e6efaf7c187d95afd/googlespy-1.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2f3c0756e12c164df7fa0e1318dacf20d1b8521cf26604fb7965c4d72c9ab502",
"md5": "907d102856ab2269f1c7ff205b18edda",
"sha256": "d9ec23c36f9ab3a6f42967f76a5a708943dad34c0f307ad531556e70374ce7f9"
},
"downloads": -1,
"filename": "googlespy-1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "907d102856ab2269f1c7ff205b18edda",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 4398,
"upload_time": "2024-11-22T07:45:58",
"upload_time_iso_8601": "2024-11-22T07:45:58.873625Z",
"url": "https://files.pythonhosted.org/packages/2f/3c/0756e12c164df7fa0e1318dacf20d1b8521cf26604fb7965c4d72c9ab502/googlespy-1.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-22 07:45:58",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "googlespy"
}