add strip() to parsed elements
This commit is contained in:
parent
3dfef07141
commit
e29f6b9a72
1 changed files with 4 additions and 3 deletions
|
|
@ -43,14 +43,14 @@ class IndexPage(PornPage):
|
||||||
url = a.attrib['href']
|
url = a.attrib['href']
|
||||||
_id = url[len('/watch/'):]
|
_id = url[len('/watch/'):]
|
||||||
_id = _id[:_id.find('/')]
|
_id = _id[:_id.find('/')]
|
||||||
title = a.text
|
title = a.text.strip()
|
||||||
|
|
||||||
duration = 0
|
duration = 0
|
||||||
div = li.cssselect('div[class=duration_views]')
|
div = li.cssselect('div[class=duration_views]')
|
||||||
if div:
|
if div:
|
||||||
h2 = div[0].find('h2')
|
h2 = div[0].find('h2')
|
||||||
duration = 60 * int(h2.text)
|
duration = 60 * int(h2.text.strip())
|
||||||
duration += int(h2.find('span').tail)
|
duration += int(h2.find('span').tail.strip())
|
||||||
|
|
||||||
rating = 0
|
rating = 0
|
||||||
rating_max = 0
|
rating_max = 0
|
||||||
|
|
@ -59,6 +59,7 @@ class IndexPage(PornPage):
|
||||||
p = div[0].find('p')
|
p = div[0].find('p')
|
||||||
rating = float(p.text.strip())
|
rating = float(p.text.strip())
|
||||||
rating_max = float(p.find('span').text.strip()[2:])
|
rating_max = float(p.find('span').text.strip()[2:])
|
||||||
|
|
||||||
yield Video(int(_id),
|
yield Video(int(_id),
|
||||||
title,
|
title,
|
||||||
rating=rating,
|
rating=rating,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue