def movie(self, imdb, title, year): try: headers = { 'Accept': '*/*', 'Accept-Language': 'en-GB,en-US;q=0.8,en;q=0.6', 'Referer': 'http://moviego.cc/', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36', 'X-Requested-With': 'XMLHttpRequest' } data = {'query': cleantitle_query(title)} # print("MOVIEGO MOVIES") title = cleantitle_query(title) cleanmovie = cleantitle_get(title) # searchquery = self.search_link % (urllib.quote_plus(title),year) query = self.search_link # print("MOVIEGO Query", headers, data) link = requests.post(query, headers=headers, data=data) link = link.content r = re.compile( '<a href="(.+?)"><span class="searchheading">(.+?)</span></a>' ).findall(link) for url, t in r: if year in t and cleanmovie == cleantitle_get(t): url = client.replaceHTMLCodes(url) url = url.encode('utf-8') # print("MOVIEGO URL PASSED", url) return url except: return
def tvshow(self, imdb, tvdb, tvshowtitle, year): try: # title = geturl(tvshowtitle) check = cleantitle.get(tvshowtitle) q = urllib.quote_plus(cleantitle_query(tvshowtitle)) q = self.search_link_2 % q print ("WATCHSERIES SEARCH", q, year) r = client.request(q, timeout='10') r = re.compile('<a href="(.+?)" title="(.+?)" target="_blank">(.+?)</a>').findall(r) for u,t,t2 in r: u = u.encode('utf-8') t = t.encode('utf-8') t2 = t2.encode('utf-8') print ("WATCHSERIES SEARCH 2", u,t,t2) # if not year in t2: # if not year in t: raise Exception() if not title_match(cleantitle_get(t), check, amount=0.9) == True: raise Exception() print ("WATCHSERIES PASSED", u) url = u.encode('utf-8') return url except: return
def tvshow(self, imdb, tvdb, tvshowtitle, year): try: # title = geturl(tvshowtitle) check = cleantitle.get(tvshowtitle) q = urllib.quote_plus(cleantitle_query(tvshowtitle)) q = self.search_link_2 % q print("WATCHSERIES SEARCH", q, year) r = client.request(q, timeout='10') r = re.compile( '<a href="(.+?)" title="(.+?)" target="_blank">(.+?)</a>' ).findall(r) for u, t, t2 in r: u = u.encode('utf-8') t = t.encode('utf-8') t2 = t2.encode('utf-8') print("WATCHSERIES SEARCH 2", u, t, t2) # if not year in t2: # if not year in t: raise Exception() if not title_match(cleantitle_get(t), check, amount=0.9) == True: raise Exception() print("WATCHSERIES PASSED", u) url = u.encode('utf-8') return url except: return
def episode(self, url, imdb, tvdb, title, premiered, season, episode): self.zen_url = [] try: data = urlparse.parse_qs(url) data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data]) title = data['tvshowtitle'] if 'tvshowtitle' in data else data['title'] data['season'], data['episode'] = season, episode title = cleantitle_query(title) titlecheck = cleantitle_get(title) query = self.search_link % (urllib.quote_plus(title)) url = urlparse.urljoin(self.base_link, query) # print ("ZEN SCRAPER ITEMS", url) r = OPEN_URL(url).content r = BeautifulSoup(r) r = r.findAll('article', attrs={'class': 'movie_item'}) for u in r: h = u.findAll('a')[0]['href'].encode('utf-8') t = u.findAll('a')[0]['data-title'].encode('utf-8') # print ("ZEN SCRAPER ITEMS", titlecheck, t,h) if titlecheck == cleantitle_get(t): type = 'shows' self.zen_url.append([h,imdb,type,season,episode]) # print ("ZEN SCRAPER ITEMS PASSED", h) return self.zen_url except: return
def movie(self, imdb, title, year): self.zen_url = [] try: title = cleantitle_query(title) titlecheck = cleantitle_get(title) query = self.search_link % (urllib.quote_plus(title)) url = urlparse.urljoin(self.base_link, query) # print ("ZEN SCRAPER ITEMS", url) r = OPEN_URL(url).content r = BeautifulSoup(r) r = r.findAll('article', attrs={'class': 'movie_item'}) for u in r: h = u.findAll('a')[0]['href'].encode('utf-8') t = u.findAll('a')[0]['data-title'].encode('utf-8') # print ("ZEN SCRAPER ITEMS", titlecheck, t,h) if titlecheck == cleantitle_get(t): type = 'movies' season = '' episode = '' self.zen_url.append([h,imdb,type,season,episode]) # print ("ZEN SCRAPER ITEMS PASSED", h) return self.zen_url except: return
def episode(self, url, imdb, tvdb, title, premiered, season, episode): self.zen_url = [] try: data = urlparse.parse_qs(url) data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data]) title = data['tvshowtitle'] if 'tvshowtitle' in data else data[ 'title'] title = cleantitle_query(title) cleanmovie = cleantitle_get(title) data['season'], data['episode'] = season, episode season = "S%02d" % int(data['season']) episode = "%02d" % int(data['episode']) episode = "E0" + episode episodecheck = season + episode print("CINEMABOX episodecheck", episodecheck) query = self.search_link % (urllib.quote_plus(title)) query = urlparse.urljoin(self.base_link, query) print("CINEMABOX query", query) r = OPEN_URL(query, mobile=True, timeout=30).json() html = r['data']['films'] for item in html: # print ("CINEMABOX ITEMS 3", item) t = item['title'].encode('utf-8') h = re.findall('''['"]id['"]\s*:\s*(\d+)''', str(item))[0] if title_match(cleanmovie, cleantitle_get(t), amount=1.0) == True: s = self.sources_link % h s = urlparse.urljoin(self.base_link, s) print("CINEMABOX PASSED 4", t, h, s) s = OPEN_URL(s, mobile=True).json() s = s['data']['chapters'] if len(s) > 0: for src in s: name = src['title'].encode('utf8') if episodecheck.lower() == name.lower(): id = re.findall('''['"]id['"]\s*:\s*(\d+)''', str(src))[0] print("CINEMABOX PASSED 6", name.lower()) stream = self.stream_link % id stream = urlparse.urljoin(self.base_link, stream) self.zen_url.append(stream) print(">>>>>>>>> Cinemabox FOUND LINK", stream) return self.zen_url except: return
def movie(self, imdb, title, year): try: headers = {'Accept':'*/*','Accept-Language':'en-GB,en-US;q=0.8,en;q=0.6', 'Referer':'http://moviego.cc/', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36', 'X-Requested-With':'XMLHttpRequest' } data = { 'query' : cleantitle_query(title) } # print("MOVIEGO MOVIES") title = cleantitle_query(title) cleanmovie = cleantitle_get(title) # searchquery = self.search_link % (urllib.quote_plus(title),year) query = self.search_link # print("MOVIEGO Query", headers, data) link = requests.post(query, headers=headers, data=data) link = link.content r = re.compile('<a href="(.+?)"><span class="searchheading">(.+?)</span></a>').findall(link) for url, t in r: if year in t and cleanmovie == cleantitle_get(t): url = client.replaceHTMLCodes(url) url = url.encode('utf-8') # print("MOVIEGO URL PASSED", url) return url except: return
def movie(self, imdb, title, year): try: self.zen_url = [] cleaned_title = cleantitle_get(title) title = cleantitle_query(title) q = self.search_link % (cleantitle_geturl(title)) r = urlparse.urljoin(self.base_link, q) print("SERIESONLINE EPISODES", r) html = BeautifulSoup(client.request(r)) containers = html.findAll('div', attrs={'class': 'ml-item'}) for result in containers: links = result.findAll('a') for link in links: link_title = link['title'].encode('utf-8') href = link['href'].encode('utf-8') href = urlparse.urljoin(self.base_link, href) href = re.sub('/watching.html', '', href) href = href + '/watching.html' print("SERIESONLINE PASSED", link_title, href) if title_match(cleantitle_get(link_title), cleaned_title) == True: referer = href html = client.request(href) match = re.findall( '<strong>Release:</strong>(.+?)</p>', html)[0] if year in match: s = BeautifulSoup(html) s = s.findAll('div', attrs={'class': 'les-content'}) for u in s: print("SERIESONLINE PASSED u", u) player = u.findAll( 'a')[0]['player-data'].encode('utf-8') if not player in self.zen_url: self.zen_url.append([player, referer]) return self.zen_url except: return
def movie(self, imdb, title, year): self.zen_url = [] try: title = cleantitle_query(title) cleanmovie = cleantitle_get(title) query = self.search_link % (urllib.quote_plus(title)) query = urlparse.urljoin(self.base_link, query) print("CINEMABOX query", query) r = OPEN_URL(query, mobile=True, timeout=30).json() print("CINEMABOX ITEMS", r) html = r['data']['films'] for item in html: print("CINEMABOX ITEMS 3", item) t = item['title'].encode('utf-8') h = re.findall('''['"]id['"]\s*:\s*(\d+)''', str(item))[0] print("CINEMABOX ITEMS 4", t, h) if title_match(cleanmovie, cleantitle_get(t), amount=1.0) == True: if year in item['publishDate']: s = self.sources_link % h s = urlparse.urljoin(self.base_link, s) print("CINEMABOX ITEMS PASSED 5", t, h, s) s = OPEN_URL(s, mobile=True).json() s = s['data']['chapters'] if len(s) > 0: for src in s: name = src['title'].encode('utf8') if title_match(cleanmovie, cleantitle_get(name), amount=1.0) == True: id = re.findall( '''['"]id['"]\s*:\s*(\d+)''', str(src))[0] stream = self.stream_link % id stream = urlparse.urljoin(self.base_link, stream) self.zen_url.append(stream) print(">>>>>>>>> Cinemabox FOUND LINK", stream) return self.zen_url except: return
def movie(self, imdb, title, year): self.elysium_url = [] try: title = cleantitle_query(title) cleanmovie = cleantitle_get(title) query = self.search_link % (urllib.quote_plus(title)) query = urlparse.urljoin(self.base_link, query) print ("CINEMABOX query", query) r = OPEN_URL(query, mobile=True, timeout=30).json() print ("CINEMABOX ITEMS", r) html = r['data']['films'] for item in html: print ("CINEMABOX ITEMS 3", item) t = item['title'].encode('utf-8') h = re.findall('''['"]id['"]\s*:\s*(\d+)''', str(item))[0] print ("CINEMABOX ITEMS 4", t,h) if title_match(cleanmovie,cleantitle_get(t), amount=1.0) == True: if year in item['publishDate']: s = self.sources_link % h s = urlparse.urljoin(self.base_link, s) print ("CINEMABOX ITEMS PASSED 5", t,h,s) s = OPEN_URL(s, mobile=True).json() s= s['data']['chapters'] if len(s)> 0: for src in s: name= src['title'].encode('utf8') if title_match(cleanmovie,cleantitle_get(name), amount=1.0) == True: id = re.findall('''['"]id['"]\s*:\s*(\d+)''', str(src))[0] stream = self.stream_link % id stream = urlparse.urljoin(self.base_link, stream) self.elysium_url.append(stream) print (">>>>>>>>> Cinemabox FOUND LINK", stream) return self.elysium_url except: return
def movie(self, imdb, title, year): try: self.elysium_url = [] cleaned_title = cleantitle_get(title) title = cleantitle_query(title) q = self.search_link % (cleantitle_geturl(title)) r = urlparse.urljoin(self.base_link, q) print ("SERIESONLINE EPISODES", r) html = BeautifulSoup(client.request(r)) containers = html.findAll('div', attrs={'class': 'ml-item'}) for result in containers: links = result.findAll('a') for link in links: link_title = link['title'].encode('utf-8') href = link['href'].encode('utf-8') href = urlparse.urljoin(self.base_link, href) href = re.sub('/watching.html','', href) href = href + '/watching.html' print("SERIESONLINE PASSED", link_title, href) if title_match(cleantitle_get(link_title), cleaned_title) == True: referer = href html = client.request(href) match = re.findall('<strong>Release:</strong>(.+?)</p>', html)[0] if year in match: s = BeautifulSoup(html) s = s.findAll('div', attrs={'class': 'les-content'}) for u in s: print("SERIESONLINE PASSED u", u) player = u.findAll('a')[0]['player-data'].encode('utf-8') if not player in self.elysium_url: self.elysium_url.append([player, referer]) return self.elysium_url except: return
def episode(self, url, imdb, tvdb, title, premiered, season, episode): self.elysium_url = [] try: data = urlparse.parse_qs(url) data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data]) title = data['tvshowtitle'] if 'tvshowtitle' in data else data['title'] title = cleantitle_query(title) cleanmovie = cleantitle_get(title) data['season'], data['episode'] = season, episode season = "S%02d" % int(data['season']) episode = "%02d" % int(data['episode']) episode = "E0" + episode episodecheck = season + episode print ("CINEMABOX episodecheck", episodecheck) query = self.search_link % (urllib.quote_plus(title)) query = urlparse.urljoin(self.base_link, query) print ("CINEMABOX query", query) r = OPEN_URL(query, mobile=True, timeout=30).json() html = r['data']['films'] for item in html: # print ("CINEMABOX ITEMS 3", item) t = item['title'].encode('utf-8') h = re.findall('''['"]id['"]\s*:\s*(\d+)''', str(item))[0] if title_match(cleanmovie,cleantitle_get(t), amount=1.0) == True: s = self.sources_link % h s = urlparse.urljoin(self.base_link, s) print ("CINEMABOX PASSED 4", t,h,s) s = OPEN_URL(s, mobile=True).json() s= s['data']['chapters'] if len(s)> 0: for src in s: name = src['title'].encode('utf8') if episodecheck.lower() == name.lower(): id = re.findall('''['"]id['"]\s*:\s*(\d+)''', str(src))[0] print ("CINEMABOX PASSED 6", name.lower()) stream = self.stream_link % id stream = urlparse.urljoin(self.base_link, stream) self.elysium_url.append(stream) print (">>>>>>>>> Cinemabox FOUND LINK", stream) return self.elysium_url except: return