mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-07 12:05:35 +00:00
Switch from googlesearch-python to serpapi
This commit is contained in:
parent
bd03839f97
commit
010e4d3ad4
@ -22,7 +22,7 @@
|
|||||||
<img src="https://img.shields.io/badge/License-GPL_3.0-blue.svg?style=for-the-badge" alt="License"/>
|
<img src="https://img.shields.io/badge/License-GPL_3.0-blue.svg?style=for-the-badge" alt="License"/>
|
||||||
</a>
|
</a>
|
||||||
<a href="https://pypi.org/project/streamingcommunity">
|
<a href="https://pypi.org/project/streamingcommunity">
|
||||||
<img src="https://img.shields.io/pypi/dw/streamingcommunity?style=for-the-badge" alt="PyPI Downloads"/>
|
<img src="https://img.shields.io/pypi/dm/streamingcommunity?style=for-the-badge" alt="PyPI Downloads"/>
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -475,7 +475,7 @@ The `run-container` command mounts also the `config.json` file, so any change to
|
|||||||
| [DDLStreamItaly](https://ddlstreamitaly.co/) | ✅ |
|
| [DDLStreamItaly](https://ddlstreamitaly.co/) | ✅ |
|
||||||
| [GuardaSerie](https://guardaserie.academy/) | ✅ |
|
| [GuardaSerie](https://guardaserie.academy/) | ✅ |
|
||||||
| [MostraGuarda](https://mostraguarda.stream/) | ✅ |
|
| [MostraGuarda](https://mostraguarda.stream/) | ✅ |
|
||||||
| [StreamingCommunity](https://streamingcommunity.ooo/) | ✅ |
|
| [StreamingCommunity](https://streamingcommunity.paris/) | ✅ |
|
||||||
|
|
||||||
|
|
||||||
# Tutorials
|
# Tutorials
|
||||||
|
@ -7,7 +7,7 @@ from urllib.parse import urlparse, unquote
|
|||||||
|
|
||||||
# External libraries
|
# External libraries
|
||||||
import httpx
|
import httpx
|
||||||
from googlesearch import search
|
from serpapi import search
|
||||||
|
|
||||||
|
|
||||||
# Internal utilities
|
# Internal utilities
|
||||||
@ -15,7 +15,7 @@ from StreamingCommunity.Util.headers import get_headers
|
|||||||
from StreamingCommunity.Util.console import console, msg
|
from StreamingCommunity.Util.console import console, msg
|
||||||
from StreamingCommunity.Util._jsonConfig import config_manager
|
from StreamingCommunity.Util._jsonConfig import config_manager
|
||||||
|
|
||||||
|
api_key = "ebfaafb043613442e0010e3795c9ead4cab196e5448a6e3728d64edbbccdf731"
|
||||||
base_headers = {
|
base_headers = {
|
||||||
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
|
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
|
||||||
'accept-language': 'it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7',
|
'accept-language': 'it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7',
|
||||||
@ -164,13 +164,20 @@ def search_domain(site_name: str, base_url: str, get_first: bool = False):
|
|||||||
console.print(f"\n[cyan]Searching for alternate domains for[white]: [yellow]{base_domain}")
|
console.print(f"\n[cyan]Searching for alternate domains for[white]: [yellow]{base_domain}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
search_results = list(search(base_domain, num_results=20, lang="it"))
|
params = {
|
||||||
|
"q": base_domain,
|
||||||
|
"hl": "it",
|
||||||
|
"gl": "it",
|
||||||
|
"num": 20,
|
||||||
|
"api_key": api_key
|
||||||
|
}
|
||||||
|
search_results = [element['link'] for element in search(params)['organic_results']]
|
||||||
base_urls = set()
|
base_urls = set()
|
||||||
|
|
||||||
for url in search_results:
|
for url in search_results:
|
||||||
base_url = get_base_url(url)
|
element_url = get_base_url(url)
|
||||||
if base_url:
|
if element_url:
|
||||||
base_urls.add(base_url)
|
base_urls.add(element_url)
|
||||||
|
|
||||||
# Filter URLs based on domain matching and subdomain count
|
# Filter URLs based on domain matching and subdomain count
|
||||||
filtered_results = [
|
filtered_results = [
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
},
|
},
|
||||||
"SITE": {
|
"SITE": {
|
||||||
"streamingcommunity": {
|
"streamingcommunity": {
|
||||||
"domain": "ooo"
|
"domain": "paris"
|
||||||
},
|
},
|
||||||
"altadefinizionegratis": {
|
"altadefinizionegratis": {
|
||||||
"domain": "info"
|
"domain": "info"
|
||||||
|
@ -11,4 +11,4 @@ pycryptodomex
|
|||||||
fake-useragent
|
fake-useragent
|
||||||
qbittorrent-api
|
qbittorrent-api
|
||||||
python-qbittorrent
|
python-qbittorrent
|
||||||
googlesearch-python
|
serpapi
|
Loading…
x
Reference in New Issue
Block a user