Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SickRage-1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
SickRage-1
Commits
39c5dc61
Commit
39c5dc61
authored
Apr 4, 2018
by
Yoann Laissus
Committed by
miigotu
Apr 6, 2018
Browse files
Options
Downloads
Patches
Plain Diff
Update the YggTorrent provider due to the new version of the website
parent
7f82bb14
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
sickbeard/providers/yggtorrent.py
+28
-21
28 additions, 21 deletions
sickbeard/providers/yggtorrent.py
with
28 additions
and
21 deletions
sickbeard/providers/yggtorrent.py
+
28
−
21
View file @
39c5dc61
...
@@ -48,7 +48,7 @@ class YggTorrentProvider(TorrentProvider): # pylint: disable=too-many-instance-
...
@@ -48,7 +48,7 @@ class YggTorrentProvider(TorrentProvider): # pylint: disable=too-many-instance-
self
.
minleech
=
None
self
.
minleech
=
None
# URLs
# URLs
self
.
url
=
'
https://yggtorrent.
com
/
'
self
.
url
=
'
https://yggtorrent.
is
/
'
self
.
urls
=
{
self
.
urls
=
{
'
login
'
:
urljoin
(
self
.
url
,
'
user/login
'
),
'
login
'
:
urljoin
(
self
.
url
,
'
user/login
'
),
'
search
'
:
urljoin
(
self
.
url
,
'
engine/search
'
)
'
search
'
:
urljoin
(
self
.
url
,
'
engine/search
'
)
...
@@ -69,16 +69,25 @@ class YggTorrentProvider(TorrentProvider): # pylint: disable=too-many-instance-
...
@@ -69,16 +69,25 @@ class YggTorrentProvider(TorrentProvider): # pylint: disable=too-many-instance-
'
pass
'
:
self
.
password
,
'
pass
'
:
self
.
password
,
}
}
response
=
self
.
get_url
(
self
.
urls
[
'
login
'
],
post_data
=
login_params
,
returns
=
'
text
'
)
response
=
self
.
get_url
(
self
.
urls
[
'
login
'
],
post_data
=
login_params
,
returns
=
'
response
'
)
if
not
response
:
# When you call /login if it's OK, it's return 200 with no body, i retry in main if it's logged !
response
=
self
.
get_url
(
self
.
url
,
returns
=
'
text
'
)
# The login is now an AJAX call (401 : Bad credentials, 200 : Logged in, other : server failure
)
if
not
response
:
# The provider is dead !!!
if
response
.
status_code
==
401
:
logger
.
log
(
'
Unable to connect to provider
'
,
logger
.
WARNING
)
logger
.
log
(
'
Invalid username or password. Check your settings
'
,
logger
.
WARNING
)
return
False
return
False
elif
response
.
status_code
==
200
:
# It seems we are logged, let's verify that !
response
=
self
.
get_url
(
self
.
url
,
returns
=
'
response
'
)
if
'
logout
'
not
in
response
:
if
response
.
status_code
!=
200
:
logger
.
log
(
'
Unable to connect to provider
'
,
logger
.
WARNING
)
return
False
if
'
logout
'
not
in
response
.
text
:
logger
.
log
(
'
Invalid username or password. Check your settings
'
,
logger
.
WARNING
)
logger
.
log
(
'
Invalid username or password. Check your settings
'
,
logger
.
WARNING
)
return
False
return
False
else
:
logger
.
log
(
'
Unable to connect to provider
'
,
logger
.
WARNING
)
return
False
return
True
return
True
...
@@ -112,15 +121,16 @@ class YggTorrentProvider(TorrentProvider): # pylint: disable=too-many-instance-
...
@@ -112,15 +121,16 @@ class YggTorrentProvider(TorrentProvider): # pylint: disable=too-many-instance-
try
:
try
:
search_params
=
{
search_params
=
{
'
category
'
:
"
2145
"
,
'
category
'
:
"
2145
"
,
'
subcategory
'
:
"
2184
"
,
'
sub_category
'
:
"
2184
"
,
'
q
'
:
re
.
sub
(
r
'
[()]
'
,
''
,
search_string
)
'
name
'
:
re
.
sub
(
r
'
[()]
'
,
''
,
search_string
),
'
do
'
:
'
search
'
}
}
data
=
self
.
get_url
(
self
.
urls
[
'
search
'
],
params
=
search_params
,
returns
=
'
text
'
)
data
=
self
.
get_url
(
self
.
urls
[
'
search
'
],
params
=
search_params
,
returns
=
'
text
'
)
if
not
data
:
if
not
data
:
continue
continue
with
BS4Parser
(
data
,
'
html5lib
'
)
as
html
:
with
BS4Parser
(
data
,
'
html5lib
'
)
as
html
:
torrent_table
=
html
.
find
(
class_
=
'
table
table-striped
'
)
torrent_table
=
html
.
find
(
class_
=
'
table
'
)
torrent_rows
=
torrent_table
(
'
tr
'
)
if
torrent_table
else
[]
torrent_rows
=
torrent_table
(
'
tr
'
)
if
torrent_table
else
[]
# Continue only if at least one Release is found
# Continue only if at least one Release is found
...
@@ -131,23 +141,20 @@ class YggTorrentProvider(TorrentProvider): # pylint: disable=too-many-instance-
...
@@ -131,23 +141,20 @@ class YggTorrentProvider(TorrentProvider): # pylint: disable=too-many-instance-
# Skip column headers
# Skip column headers
for
result
in
torrent_rows
[
1
:]:
for
result
in
torrent_rows
[
1
:]:
cells
=
result
(
'
td
'
)
cells
=
result
(
'
td
'
)
if
len
(
cells
)
<
5
:
if
len
(
cells
)
<
9
:
continue
continue
download_url
=
""
title
=
cells
[
1
].
find
(
'
a
'
).
get_text
(
strip
=
True
)
title
=
cells
[
0
].
find
(
'
a
'
,
class_
=
'
torrent-name
'
).
get_text
(
strip
=
True
)
id
=
cells
[
2
].
find
(
'
a
'
)[
'
target
'
]
for
download_img
in
cells
[
0
].
select
(
'
a[href] img
'
):
download_url
=
urljoin
(
self
.
url
,
'
engine/download_torrent?id=
'
+
id
)
if
download_img
[
'
src
'
]
==
urljoin
(
self
.
url
,
"
static/icons/icon_download.gif
"
):
download_url
=
urljoin
(
self
.
url
,
download_img
.
parent
[
'
href
'
])
break
if
not
(
title
and
download_url
):
if
not
(
title
and
download_url
):
continue
continue
seeders
=
try_int
(
cells
[
4
].
get_text
(
strip
=
True
))
seeders
=
try_int
(
cells
[
7
].
get_text
(
strip
=
True
))
leechers
=
try_int
(
cells
[
5
].
get_text
(
strip
=
True
))
leechers
=
try_int
(
cells
[
8
].
get_text
(
strip
=
True
))
torrent_size
=
cells
[
2
].
get_text
()
torrent_size
=
cells
[
5
].
get_text
()
size
=
convert_size
(
torrent_size
)
or
-
1
size
=
convert_size
(
torrent_size
)
or
-
1
# Filter unseeded torrent
# Filter unseeded torrent
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment