Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Exodus Add-on
- Copyright (C) 2016 Exodus
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- """
- import re
- import urllib
- import urlparse
- from resources.lib.modules import cleantitle
- from resources.lib.modules import client
- from resources.lib.modules import dom_parser
- from resources.lib.modules import source_utils
- class source:
- def __init__(self):
- self.priority = 1
- self.language = ['it']
- self.domains = ['italia-film.gratis']
- self.base_link = 'http://www.italia-film.gratis'
- self.search_link = '/?s=%s'
- def movie(self, imdb, title, localtitle, aliases, year):
- try:
- url = self.__search(localtitle)
- if not url and title != localtitle: url = self.__search(title)
- return url
- except:
- return
- def sources(self, url, hostDict, hostprDict):
- sources = []
- try:
- if not url:
- return sources
- url = urlparse.urljoin(self.base_link, url)
- r = client.request(url)
- r = re.compile('<article(.*?)</article>', re.DOTALL).findall(r)
- r = dom_parser.parse_dom(r, 'a', req='href')
- r = [i.attrs['href'] for i in r]
- for url in r:
- valid, hoster = source_utils.is_host_valid(url, hostDict)
- if not valid: continue
- sources.append({'source': hoster, 'quality': 'HD', 'language': 'it', 'url': url, 'direct': False, 'debridonly': False, 'checkquality': True})
- return sources
- except:
- return sources
- def resolve(self, url):
- return url
- def __search(self, title):
- try:
- query = self.search_link % (urllib.quote_plus(cleantitle.query(title)))
- query = urlparse.urljoin(self.base_link, query)
- t = cleantitle.get(title)
- r = client.request(query)
- r = dom_parser.parse_dom(r, 'div', attrs={'class': ['entry-summary']})
- r = dom_parser.parse_dom(r, 'a', req='href')
- r = [(i.attrs['href'], i.attrs['title']) for i in r]
- r = [(i[0], i[1]) for i in r if i[1]]
- r = [i[0] for i in r if t == cleantitle.get(i[1])][0]
- return source_utils.strip_domain(r)
- except:
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement