Skip to content

Commit 04d34bd

Browse files
get 720p if 1080 dosnt exist
1 parent 46a637e commit 04d34bd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

clients/lostfilm_client.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ def tag_with_1080p_link(tag):
6262
return tag.name == 'a' and tag.has_attr('href') and '1080p' in tag.text
6363

6464

65+
def tag_with_720p_link(tag):
66+
return tag.name == 'a' and tag.has_attr('href') and '720p' in tag.text
67+
68+
6569
def get_redirect_url(torrent_mirror, series_id, lostfilm_lf_session, proxies):
6670
torrent_page = torrent_mirror + '/v_search.php?a=' + series_id
6771
cookies = {'lf_session': lostfilm_lf_session}
@@ -75,7 +79,10 @@ def get_redirect_url(torrent_mirror, series_id, lostfilm_lf_session, proxies):
7579
def get_torrent_url(redirect_url, proxies):
7680
res = network.get(redirect_url, proxies=proxies)
7781
soup = BeautifulSoup(res.text, 'html.parser')
78-
torrent_url = soup.find(tag_with_1080p_link).attrs['href']
82+
item = soup.find(tag_with_1080p_link)
83+
if item is None:
84+
item = soup.find(tag_with_720p_link)
85+
torrent_url = item.attrs['href']
7986

8087
return torrent_url
8188

0 commit comments

Comments
 (0)