Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sick-Beard
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
Sick-Beard
Commits
f4939b63
Commit
f4939b63
authored
Jun 3, 2015
by
sarakha63
Browse files
Options
Downloads
Plain Diff
Merge pull request #339 from stef76/development
Update xthor.py
parents
46cd3178
e8cabe88
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/xthor.py
+170
-172
170 additions, 172 deletions
sickbeard/providers/xthor.py
with
170 additions
and
172 deletions
sickbeard/providers/xthor.py
+
170
−
172
View file @
f4939b63
...
...
@@ -37,6 +37,7 @@ class XTHORProvider(generic.TorrentProvider):
self
.
supportsBacklog
=
True
self
.
cj
=
cookielib
.
CookieJar
()
self
.
opener
=
urllib2
.
build_opener
(
urllib2
.
HTTPCookieProcessor
(
self
.
cj
))
...
...
@@ -51,18 +52,13 @@ class XTHORProvider(generic.TorrentProvider):
def
getSearchParams
(
self
,
searchString
,
audio_lang
,
french
=
None
,
fullSeason
=
False
):
results
=
[]
if
audio_lang
==
"
en
"
and
french
==
None
:
results
.
append
(
urllib
.
urlencode
(
{
'
keywords
'
:
searchString
,
}
)
+
"
&cid=43,69&[PARAMSTR]=
"
+
searchString
)
results
.
append
(
"
c16=1&c17=1&searchin=title&search=
"
+
searchString
)
elif
audio_lang
==
"
fr
"
or
french
:
results
.
append
(
urllib
.
urlencode
(
{
'
keywords
'
:
searchString
}
)
+
"
&cid=42,41&[PARAMSTR]=
"
+
searchString
)
results
.
append
(
"
c14=1&c15=1&searchin=title&search=
"
+
searchString
)
else
:
results
.
append
(
urllib
.
urlencode
(
{
'
keywords
'
:
searchString
}
)
+
"
&cid=42,43,41,69&[PARAMSTR]=
"
+
searchString
)
results
.
append
(
"
c14=1&c15=1&c16=1&c17=1&searchin=title&search=
"
+
searchString
)
#Désactivé car on ne peut pas savoir la langue
#if fullSeason:
# results.append( urllib.urlencode( {
...
...
@@ -116,12 +112,12 @@ class XTHORProvider(generic.TorrentProvider):
self
.
opener
.
addheaders
=
[(
'
User-agent
'
,
random
.
choice
(
listeUserAgents
))]
data
=
urllib
.
urlencode
({
'
action
'
:
'
login
'
,
'
loginbox_memb
ername
'
:
login
,
'
loginbox_
password
'
:
password
,
'
loginbox_remember
'
:
'
true
'
})
data
=
urllib
.
urlencode
({
'
action
'
:
'
take
login
.php
'
,
'
us
ername
'
:
login
,
'
password
'
:
password
,
'
submitme
'
:
'
X
'
})
r
=
self
.
opener
.
open
(
self
.
url
+
'
/
ajax/
login.php
'
,
data
)
r
=
self
.
opener
.
open
(
self
.
url
+
'
/
take
login.php
'
,
data
)
for
index
,
cookie
in
enumerate
(
self
.
cj
):
if
(
cookie
.
name
==
"
tsue_member
"
):
self
.
login_done
=
True
if
(
cookie
.
name
==
"
uid
"
):
self
.
login_done
=
True
if
not
self
.
login_done
and
not
self
.
failed_login_logged
:
logger
.
log
(
u
"
Unable to login to XTHOR. Please check username and password.
"
,
logger
.
WARNING
)
...
...
@@ -139,7 +135,7 @@ class XTHORProvider(generic.TorrentProvider):
results
=
[]
searchUrl
=
self
.
url
+
'
?p=torrents&pid=10&search_type=name&
'
+
searchString
.
replace
(
'
!
'
,
''
)
searchUrl
=
self
.
url
+
'
/browse.php?
'
+
searchString
.
replace
(
'
!
'
,
''
)
logger
.
log
(
u
"
Search string:
"
+
searchUrl
,
logger
.
DEBUG
)
...
...
@@ -147,23 +143,25 @@ class XTHORProvider(generic.TorrentProvider):
soup
=
BeautifulSoup
(
r
)
resultsTable
=
soup
.
find
(
"
table
"
,
{
"
id
"
:
"
t
orrents_table_classic
"
})
resultsTable
=
soup
.
find
(
"
table
"
,
{
"
class
"
:
"
t
able2
"
})
if
resultsTable
:
rows
=
resultsTable
.
findAll
(
"
tr
"
)
for
row
in
rows
:
link
=
row
.
find
(
"
a
"
,
href
=
re
.
compile
(
"
action=
details
"
))
link
=
row
.
find
(
"
a
"
,
href
=
re
.
compile
(
"
details
.php
"
))
if
link
:
title
=
link
.
text
recherched
=
searchUrl
.
split
(
"
&
[PARAMSTR]
=
"
)[
1
]
recherched
=
searchUrl
.
split
(
"
&
search
=
"
)[
1
]
recherched
=
recherched
.
replace
(
"
"
,
"
(.*)
"
)
recherched
=
recherched
+
"
(.*)
"
logger
.
log
(
u
"
XTHOR TITLE :
"
+
title
,
logger
.
DEBUG
)
logger
.
log
(
u
"
XTHOR CHECK MATCH :
"
+
recherched
,
logger
.
DEBUG
)
if
re
.
match
(
recherched
,
title
,
re
.
IGNORECASE
):
downloadURL
=
row
.
find
(
"
a
"
,
href
=
re
.
compile
(
"
action=download
"
))[
'
href
'
]
downloadURL
=
row
.
find
(
"
a
"
,
href
=
re
.
compile
(
"
download.php
"
))[
'
href
'
]
downloadURL
=
self
.
url
+
'
/
'
+
downloadURL
logger
.
log
(
u
"
XTHOR DOWNLOAD URL :
"
+
downloadURL
,
logger
.
DEBUG
)
else
:
continue
...
...
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