Lovi d447cf53b7
Test httpx (#149)
* Migrate to httpx

* Revert "Migrate to httpx"

This reverts commit fdd2823865824eca5e8cb8806dbddba4bcb37280.

* Migrate httpx

* minor fixes (#146)

* Update headers

* Update config

* 1v. Add retry

* v1 Finish Guardaserie

* Need to fix client.

* Remove retry

* v2 Add comment guardaserie.

* Add domain ...

* Finish add ddl ...

* Fix use of proxy.

* Fix cookie error.

* Update cookie.

* Dynamic import.

---------

Co-authored-by: Francesco Grazioso <40018163+FrancescoGrazioso@users.noreply.github.com>
2024-06-14 17:07:51 +02:00

57 lines
1.3 KiB
Python

# 21.05.24
# Internal utilities
from Src.Util.console import console, msg
# Logic class
from .site import (
get_version_and_domain,
title_search,
get_select_title
)
from .film import download_film
from .series import download_series
# Variable
indice = 0
def search():
"""
Main function of the application for film and series.
"""
# Make request to site to get content that corrsisponde to that string
string_to_search = msg.ask("\n[purple]Insert word to search in all site").strip()
# Get site domain and version and get result of the search
site_version, domain = get_version_and_domain()
len_database = title_search(string_to_search, domain)
if len_database > 0:
# Select title from list
select_title = get_select_title()
# For series
if select_title.type == 'tv':
download_series(
tv_id=select_title.id,
tv_name=select_title.slug,
version=site_version,
domain=domain
)
# For film
else:
download_film(
id_film=select_title.id,
title_name=select_title.slug,
domain=domain
)
else:
console.print(f"\n[red]Nothing matching was found for[white]: [purple]{string_to_search}")