Use html parser for hdtrailers
This commit is contained in:
@@ -21,6 +21,7 @@ class HDTrailers(TrailerProvider):
|
|||||||
'backup': 'http://www.hd-trailers.net/blog/',
|
'backup': 'http://www.hd-trailers.net/blog/',
|
||||||
}
|
}
|
||||||
providers = ['apple.ico', 'yahoo.ico', 'moviefone.ico', 'myspace.ico', 'favicon.ico']
|
providers = ['apple.ico', 'yahoo.ico', 'moviefone.ico', 'myspace.ico', 'favicon.ico']
|
||||||
|
only_tables_tags = SoupStrainer('table')
|
||||||
|
|
||||||
def search(self, group):
|
def search(self, group):
|
||||||
|
|
||||||
@@ -67,8 +68,7 @@ class HDTrailers(TrailerProvider):
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
try:
|
try:
|
||||||
tables = SoupStrainer('div')
|
html = BeautifulSoup(data, 'html.parser', parse_only = self.only_tables_tags)
|
||||||
html = BeautifulSoup(data, parse_only = tables)
|
|
||||||
result_table = html.find_all('h2', text = re.compile(movie_name))
|
result_table = html.find_all('h2', text = re.compile(movie_name))
|
||||||
|
|
||||||
for h2 in result_table:
|
for h2 in result_table:
|
||||||
@@ -90,8 +90,7 @@ class HDTrailers(TrailerProvider):
|
|||||||
|
|
||||||
results = {'480p':[], '720p':[], '1080p':[]}
|
results = {'480p':[], '720p':[], '1080p':[]}
|
||||||
try:
|
try:
|
||||||
tables = SoupStrainer('table')
|
html = BeautifulSoup(data, 'html.parser', parse_only = self.only_tables_tags)
|
||||||
html = BeautifulSoup(data, parse_only = tables)
|
|
||||||
result_table = html.find('table', attrs = {'class':'bottomTable'})
|
result_table = html.find('table', attrs = {'class':'bottomTable'})
|
||||||
|
|
||||||
for tr in result_table.find_all('tr'):
|
for tr in result_table.find_all('tr'):
|
||||||
|
|||||||
Reference in New Issue
Block a user