Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CouchPotatoServer
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
CouchPotatoServer
Commits
b62afc63
Commit
b62afc63
authored
Sep 4, 2012
by
Ruud
Browse files
Options
Downloads
Patches
Plain Diff
Speed up Userscript by not using BeautifulSoup. fix #796
parent
012ae976
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
couchpotato/core/providers/userscript/allocine/main.py
+17
-7
17 additions, 7 deletions
couchpotato/core/providers/userscript/allocine/main.py
couchpotato/core/providers/userscript/rottentomatoes/main.py
+23
-6
23 additions, 6 deletions
couchpotato/core/providers/userscript/rottentomatoes/main.py
with
40 additions
and
13 deletions
couchpotato/core/providers/userscript/allocine/main.py
+
17
−
7
View file @
b62afc63
from
bs4
import
BeautifulSoup
from
couchpotato.core.logger
import
CPLog
from
couchpotato.core.providers.userscript.base
import
UserscriptBase
from
couchpotato.core.providers.userscript.base
import
UserscriptBase
import
traceback
log
=
CPLog
(
__name__
)
class
AlloCine
(
UserscriptBase
):
class
AlloCine
(
UserscriptBase
):
...
@@ -15,11 +19,17 @@ class AlloCine(UserscriptBase):
...
@@ -15,11 +19,17 @@ class AlloCine(UserscriptBase):
except
:
except
:
return
return
html
=
BeautifulSoup
(
data
)
name
=
None
title
=
html
.
find
(
'
title
'
).
contents
[
0
].
strip
()
year
=
None
split
=
title
.
split
(
'
) -
'
)
name
=
split
[
0
][:
-
5
].
strip
()
try
:
year
=
split
[
0
][
-
4
:]
start
=
data
.
find
(
'
<title>
'
)
end
=
data
.
find
(
'
</title>
'
,
start
)
page_title
=
data
[
start
+
len
(
'
<title>
'
):
end
].
strip
().
split
(
'
-
'
)
name
=
page_title
[
0
].
strip
()
year
=
page_title
[
1
].
strip
()[
-
4
:]
return
self
.
search
(
name
,
year
)
return
self
.
search
(
name
,
year
)
except
:
log
.
error
(
'
Failed parsing page for title and year: %s
'
,
traceback
.
format_exc
())
This diff is collapsed.
Click to expand it.
couchpotato/core/providers/userscript/rottentomatoes/main.py
+
23
−
6
View file @
b62afc63
from
bs4
import
BeautifulSoup
from
couchpotato.core.logger
import
CPLog
from
couchpotato.core.event
import
fireEvent
from
couchpotato.core.providers.userscript.base
import
UserscriptBase
from
couchpotato.core.providers.userscript.base
import
UserscriptBase
import
re
import
traceback
log
=
CPLog
(
__name__
)
class
RottenTomatoes
(
UserscriptBase
):
class
RottenTomatoes
(
UserscriptBase
):
...
@@ -16,7 +20,20 @@ class RottenTomatoes(UserscriptBase):
...
@@ -16,7 +20,20 @@ class RottenTomatoes(UserscriptBase):
except
:
except
:
return
return
html
=
BeautifulSoup
(
data
)
try
:
title
=
html
.
find
(
'
span
'
,
{
'
itemprop
'
:
'
name
'
}).
text
name
=
None
info
=
fireEvent
(
'
scanner.name_year
'
,
title
,
single
=
True
)
year
=
None
return
self
.
search
(
info
[
'
name
'
],
info
[
'
year
'
])
metas
=
re
.
findall
(
"
property=
\"
(video:release_date|og:title)
\"
content=
\"
([^
\"
]*)
\"
"
,
data
)
for
meta
in
metas
:
mname
,
mvalue
=
meta
if
mname
==
'
og:title
'
:
name
=
mvalue
.
decode
(
'
unicode_escape
'
)
elif
mname
==
'
video:release_date
'
:
year
=
mvalue
[:
4
]
if
name
and
year
:
return
self
.
search
(
name
,
year
)
except
:
log
.
error
(
'
Failed parsing page for title and year: %s
'
,
traceback
.
format_exc
())
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