forked from jbonet/TuSubseeker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatus_checker.py
executable file
·49 lines (43 loc) · 1.54 KB
/
status_checker.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# coding=utf-8
from bs4 import BeautifulSoup
import requests
import sys
import re
version = []
def getStatus(release, showInfo, html):
url = "http://tusubtitulo.com/serie/%s/%s/%s/0" % (showInfo.title,
showInfo.season,
showInfo.episode)
try:
if html is None:
pageHtml = requests.get(url)
if pageHtml.status_code > 300:
print("TV Series not found," +
" have you misspelled it?")
sys.exit(-1)
html = pageHtml.text
soup = BeautifulSoup(html, 'lxml')
except UnboundLocalError:
print("Exception thrown")
sys.exit(-1)
iterations = 0
for versiones in soup.find_all('div', id=re.compile("version[0-9]+")):
version.append(iterations)
for listas in versiones.find_all('ul', class_="sslist"):
wowo = []
for lis in listas.contents:
item = None
try:
item = lis.contents[1]
item = item.text
except (IndexError, AttributeError):
wut = lis.string
if u"\n" != wut:
item = wut.replace(u"\t", "")
item = item.replace(u"\n", "")
if item is not None:
wowo.append(item)
version.append(wowo)
if iterations == release:
return version
iterations += 1