Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed EZTV plugin #291

Merged
merged 6 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions nova3/engines/eztv.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#VERSION: 1.14
#VERSION: 1.15
# AUTHORS: nindogo
# CONTRIBUTORS: Diego de las Heras ([email protected])

import urllib.error
import urllib.parse
import urllib.request
from html.parser import HTMLParser

from novaprinter import prettyPrinter
Expand All @@ -10,7 +13,7 @@

class eztv(object):
name = "EZTV"
url = 'https://eztv.re'
url = 'https://eztvx.to/'
supported_categories = {'all': 'all', 'tv': 'tv'}

class MyHtmlParser(HTMLParser):
Expand Down Expand Up @@ -59,9 +62,25 @@ def handle_endtag(self, tag):
prettyPrinter(self.current_item)
self.in_table_row = False

def do_query(self, what):
url = f"{self.url}/search/{what.replace('%20', '-')}"
data = b"layout=def_wlinks"
try:
return retrieve_url(url, request_data=data)
except TypeError:
# Older versions of retrieve_url did not support request_data/POST, se we must do the
# request ourselves...
user_agent = 'Mozilla/5.0 (X11; Linux x86_64; rv:125.0) Gecko/20100101 Firefox/125.0'
req = urllib.request.Request(url, data, {'User-Agent': user_agent})
try:
response = urllib.request.urlopen(req) # nosec B310
return response.read().decode('utf-8')
except urllib.error.URLError as errno:
print(f"Connection error: {errno.reason}")
return ""

def search(self, what, cat='all'):
query = self.url + '/search/' + what.replace('%20', '-')
eztv_html = retrieve_url(query)
eztv_html = self.do_query(what)

eztv_parser = self.MyHtmlParser(self.url)
eztv_parser.feed(eztv_html)
Expand Down
2 changes: 1 addition & 1 deletion nova3/engines/versions.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
eztv: 1.14
eztv: 1.15
jackett: 4.0
limetorrents: 4.7
piratebay: 3.3
Expand Down