Fix urlencode

This commit is contained in:
Michel Roux 2023-01-04 22:46:13 +01:00
parent 39e9d123b5
commit 69b6562121
2 changed files with 14 additions and 11 deletions

View File

@ -1,7 +1,7 @@
from datetime import datetime
from os import getenv
from typing import List
from urllib.parse import urlencode
from urllib import parse
from bs4 import BeautifulSoup
from pydantic import HttpUrl, parse_obj_as
@ -24,7 +24,7 @@ class Nyaa(Bridge):
def search_url(self, query: str = "", page: int = 1) -> HttpUrl:
to_query = "|".join(map(lambda word: f"({query} {word})", VF_WORDS))
params = urlencode(
params = parse.urlencode(
{
"f": 0,
"c": "1_3",
@ -86,7 +86,7 @@ class EraiRaws(Nyaa):
title = "Erai-raws"
def search_url(self, query: str = "", page: int = 1) -> HttpUrl:
params = urlencode(
params = parse.urlencode(
{
"f": 0,
"c": "1_2",

View File

@ -1,4 +1,5 @@
from typing import List
from urllib import parse
from bs4 import BeautifulSoup
from humanfriendly import parse_size
@ -21,7 +22,8 @@ class YggTorrent(Bridge):
sub_category = 2179
def search_url(self, query: str = "", page: int = 1) -> HttpUrl:
params = {
params = parse.urlencode(
{
"name": query,
"category": 2145,
"sub_category": self.sub_category,
@ -29,6 +31,7 @@ class YggTorrent(Bridge):
"order": "desc",
"sort": "size" if query else "publish_date",
}
)
return parse_obj_as(HttpUrl, f"{self.base_url}?{params}")