Skip to content

Commit

Permalink
better movie recognition
Browse files Browse the repository at this point in the history
By checking downloadable link rather than provided filename which
sometime can have space
  • Loading branch information
ratanparai committed Nov 12, 2015
1 parent a6b5eb6 commit de56335
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions resources/lib/cinehub.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,19 @@ def getVideoLink(self, session, URL):
for i in range(1,5):
try:
tempName = linkTable.find('tbody').findAll('td')[tdId].find('b').string
#print tempName

# get downloadable link
tempVideoLink = linkTable.find('tbody').findAll('td')[tdId+3].find('a')['href']
result = session.get(tempVideoLink).content
soup = BeautifulSoup(result)
link = soup.find('div', attrs={'id': 'download_btn_r'}).find('a')['href'].strip()

# video file format mp4, avi and mkv and not containing sample
if tempName.find('.mp4') != -1 or tempName.find('.avi') != -1 or tempName.find('.mkv') != -1 :
if tempName.lower().find("sample") != -1 or tempName.lower().find("trailer") != -1 :
if link.lower().endswith(('mp4' , 'avi' , 'mkv')) :
if link.lower().find("sample") != -1 or link.lower().find("trailer") != -1 :
pass
else:
tempVideoLink = linkTable.find('tbody').findAll('td')[tdId+3].find('a')['href']
result = session.get(tempVideoLink).content
soup = BeautifulSoup(result)
link = soup.find('div', attrs={'id': 'download_btn_r'}).find('a')['href']
return link.strip()
return link
else:
tdId += 5
except:
Expand Down

0 comments on commit de56335

Please sign in to comment.