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
425b3c69
Commit
425b3c69
authored
Nov 20, 2015
by
Dustyn Gibson
Browse files
Options
Downloads
Patches
Plain Diff
Switch to html5lib for parsing newznab/torznab xml
parent
7a8d5eb6
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/newznab.py
+7
-16
7 additions, 16 deletions
sickbeard/providers/newznab.py
with
7 additions
and
16 deletions
sickbeard/providers/newznab.py
+
7
−
16
View file @
425b3c69
...
@@ -117,7 +117,7 @@ class NewznabProvider(generic.NZBProvider):
...
@@ -117,7 +117,7 @@ class NewznabProvider(generic.NZBProvider):
logger
.
log
(
error_string
,
logger
.
WARNING
)
logger
.
log
(
error_string
,
logger
.
WARNING
)
return
False
,
return_categories
,
error_string
return
False
,
return_categories
,
error_string
data
=
BeautifulSoup
(
data
)
data
=
BeautifulSoup
(
data
,
features
=
[
"
html5lib
"
,
"
permissive
"
]
)
if
not
self
.
_checkAuthFromData
(
data
):
if
not
self
.
_checkAuthFromData
(
data
):
data
.
decompose
()
data
.
decompose
()
error_string
=
u
"
Error parsing xml for [%s]
"
%
(
self
.
name
)
error_string
=
u
"
Error parsing xml for [%s]
"
%
(
self
.
name
)
...
@@ -209,17 +209,8 @@ class NewznabProvider(generic.NZBProvider):
...
@@ -209,17 +209,8 @@ class NewznabProvider(generic.NZBProvider):
Checks that the returned data is valid
Checks that the returned data is valid
Returns: _checkAuth if valid otherwise False if there is an error
Returns: _checkAuth if valid otherwise False if there is an error
"""
"""
try
:
if
data
.
findAll
(
'
categories
'
)
+
data
.
findAll
(
'
item
'
):
assert
data
.
caps
.
categories
is
not
None
return
self
.
_checkAuth
()
except
(
AssertionError
,
AttributeError
):
pass
try
:
assert
data
.
rss
.
channel
.
item
is
not
None
return
self
.
_checkAuth
()
return
self
.
_checkAuth
()
except
(
AssertionError
,
AttributeError
):
pass
try
:
try
:
err_code
=
int
(
data
.
error
.
attrs
[
'
code
'
])
err_code
=
int
(
data
.
error
.
attrs
[
'
code
'
])
...
@@ -273,7 +264,7 @@ class NewznabProvider(generic.NZBProvider):
...
@@ -273,7 +264,7 @@ class NewznabProvider(generic.NZBProvider):
if
not
data
:
if
not
data
:
return
results
return
results
data
=
BeautifulSoup
(
data
)
data
=
BeautifulSoup
(
data
,
features
=
[
"
html5lib
"
,
"
permissive
"
]
)
try
:
try
:
torznab
=
'
xmlns:torznab
'
in
data
.
rss
.
attrs
.
keys
()
torznab
=
'
xmlns:torznab
'
in
data
.
rss
.
attrs
.
keys
()
...
@@ -284,16 +275,16 @@ class NewznabProvider(generic.NZBProvider):
...
@@ -284,16 +275,16 @@ class NewznabProvider(generic.NZBProvider):
data
.
decompose
()
data
.
decompose
()
return
results
return
results
for
item
in
data
.
rss
.
channel
.
findAll
(
'
item
'
):
for
item
in
data
.
findAll
(
'
item
'
):
try
:
try
:
title
=
item
.
title
.
t
ext
.
strip
()
title
=
item
.
title
.
n
ext
.
strip
()
download_url
=
item
.
link
.
t
ext
.
strip
()
download_url
=
item
.
link
.
n
ext
.
strip
()
except
(
AttributeError
,
TypeError
):
except
(
AttributeError
,
TypeError
):
continue
continue
if
title
and
download_url
:
if
title
and
download_url
:
size
=
seeders
=
leechers
=
None
size
=
seeders
=
leechers
=
None
for
attr
in
item
.
findAll
(
'
attr
'
):
for
attr
in
item
.
findAll
(
'
newznab:attr
'
)
+
item
.
findAll
(
'
torznab:
attr
'
):
size
=
helpers
.
tryInt
(
attr
[
'
value
'
],
-
1
)
if
attr
[
'
name
'
]
==
'
size
'
else
size
size
=
helpers
.
tryInt
(
attr
[
'
value
'
],
-
1
)
if
attr
[
'
name
'
]
==
'
size
'
else
size
seeders
=
helpers
.
tryInt
(
attr
[
'
value
'
],
1
)
if
attr
[
'
name
'
]
==
'
seeders
'
else
seeders
seeders
=
helpers
.
tryInt
(
attr
[
'
value
'
],
1
)
if
attr
[
'
name
'
]
==
'
seeders
'
else
seeders
leechers
=
helpers
.
tryInt
(
attr
[
'
value
'
],
0
)
if
attr
[
'
name
'
]
==
'
leechers
'
else
leechers
leechers
=
helpers
.
tryInt
(
attr
[
'
value
'
],
0
)
if
attr
[
'
name
'
]
==
'
leechers
'
else
leechers
...
...
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