Fix urlencode
This commit is contained in:
parent
39e9d123b5
commit
69b6562121
@ -1,7 +1,7 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from os import getenv
|
from os import getenv
|
||||||
from typing import List
|
from typing import List
|
||||||
from urllib.parse import urlencode
|
from urllib import parse
|
||||||
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from pydantic import HttpUrl, parse_obj_as
|
from pydantic import HttpUrl, parse_obj_as
|
||||||
@ -24,7 +24,7 @@ class Nyaa(Bridge):
|
|||||||
|
|
||||||
def search_url(self, query: str = "", page: int = 1) -> HttpUrl:
|
def search_url(self, query: str = "", page: int = 1) -> HttpUrl:
|
||||||
to_query = "|".join(map(lambda word: f"({query} {word})", VF_WORDS))
|
to_query = "|".join(map(lambda word: f"({query} {word})", VF_WORDS))
|
||||||
params = urlencode(
|
params = parse.urlencode(
|
||||||
{
|
{
|
||||||
"f": 0,
|
"f": 0,
|
||||||
"c": "1_3",
|
"c": "1_3",
|
||||||
@ -86,7 +86,7 @@ class EraiRaws(Nyaa):
|
|||||||
title = "Erai-raws"
|
title = "Erai-raws"
|
||||||
|
|
||||||
def search_url(self, query: str = "", page: int = 1) -> HttpUrl:
|
def search_url(self, query: str = "", page: int = 1) -> HttpUrl:
|
||||||
params = urlencode(
|
params = parse.urlencode(
|
||||||
{
|
{
|
||||||
"f": 0,
|
"f": 0,
|
||||||
"c": "1_2",
|
"c": "1_2",
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from typing import List
|
from typing import List
|
||||||
|
from urllib import parse
|
||||||
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from humanfriendly import parse_size
|
from humanfriendly import parse_size
|
||||||
@ -21,7 +22,8 @@ class YggTorrent(Bridge):
|
|||||||
sub_category = 2179
|
sub_category = 2179
|
||||||
|
|
||||||
def search_url(self, query: str = "", page: int = 1) -> HttpUrl:
|
def search_url(self, query: str = "", page: int = 1) -> HttpUrl:
|
||||||
params = {
|
params = parse.urlencode(
|
||||||
|
{
|
||||||
"name": query,
|
"name": query,
|
||||||
"category": 2145,
|
"category": 2145,
|
||||||
"sub_category": self.sub_category,
|
"sub_category": self.sub_category,
|
||||||
@ -29,6 +31,7 @@ class YggTorrent(Bridge):
|
|||||||
"order": "desc",
|
"order": "desc",
|
||||||
"sort": "size" if query else "publish_date",
|
"sort": "size" if query else "publish_date",
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
|
||||||
return parse_obj_as(HttpUrl, f"{self.base_url}?{params}")
|
return parse_obj_as(HttpUrl, f"{self.base_url}?{params}")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user