lambdascrapers
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bobmovies.py 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # -*- coding: UTF-8 -*-
  2. import re,urllib,urlparse
  3. from resources.lib.modules import cleantitle
  4. from resources.lib.modules import client
  5. from resources.lib.modules import log_utils
  6. from resources.lib.modules import source_utils
  7. class source:
  8. def __init__(self):
  9. self.priority = 1
  10. self.language = ['en']
  11. self.domains = ['bobmovies.site']
  12. self.base_link = 'http://bobmovies.site'
  13. self.search_link = '/?s=%s'
  14. def movie(self, imdb, title, localtitle, aliases, year):
  15. try:
  16. search_id = title.lower()
  17. url = urlparse.urljoin(self.base_link, self.search_link)
  18. url = url % (search_id.replace(':', '%3A').replace('&', '%26').replace("'", '%27').replace(' ', '+').replace('...', ' '))
  19. search_results = client.request(url)
  20. match = re.compile('<div id="post.+?href="(.+?)".+?title="(.+?)"',re.DOTALL).findall(search_results)
  21. for movie_url, movie_title in match:
  22. clean_title = cleantitle.get(title)
  23. movie_title = movie_title.replace('&#8230', ' ').replace('&#038', ' ').replace('&#8217', ' ').replace('...', ' ')
  24. clean_movie_title = cleantitle.get(movie_title)
  25. if clean_movie_title in clean_title:
  26. return movie_url
  27. return
  28. except:
  29. failure = traceback.format_exc()
  30. log_utils.log('MyBobMovies - movie - Exception: \n' + str(failure))
  31. return
  32. def sources(self, url, hostDict, hostprDict):
  33. try:
  34. sources = []
  35. if url == None: return sources
  36. html = client.request(url)
  37. links = re.compile('<iframe width=".+?src="(.+?)"',re.DOTALL).findall(html)
  38. for link in links:
  39. quality,info = source_utils.get_release_quality(link, url)
  40. host = link.split('//')[1].replace('www.','')
  41. host = host.split('/')[0].split('.')[0].title()
  42. sources.append({'source': host, 'quality': quality, 'language': 'en', 'url': link, 'direct': False, 'debridonly': False})
  43. return sources
  44. except:
  45. failure = traceback.format_exc()
  46. log_utils.log('MyBobMovies - sources - Exception: \n' + str(failure))
  47. return sources
  48. def resolve(self, url):
  49. return url