def __get_post_info(self, fpt_post): try: post_title = scraper_lib.Element(block=fpt_post, el_tag="h5", el_class="titleFilm", get_text=True).get_element() except: post_title = scraper_lib.Element(block=fpt_post, el_tag="h2", el_class="titleFilm", get_text=True).get_element() post_ref_url = scraper_lib.Element(block=fpt_post, el_tag="a", el_property="href").get_element() try: image = scraper_lib.Element( block=fpt_post, el_tag="img", el_class="attachment-loc-film size-loc-film wp-post-image", el_property="src").get_element() except: image = "n.d." movie = Movie(title=post_title, page_url=post_ref_url) movie.image_url = image return movie
def get_all_seasons(self): if sys.version_info[0] < 3: del self.seasons_lst[:] else: self.seasons_lst.clear() if self.is_modern_state: season_container = scraper_lib.Container( block=self.seasons_wrapper, tag='div', container_class='accordion-item') title = scraper_lib.Element(block='', el_tag='ul', get_text=True) else: #old version season_container = scraper_lib.Container( block=self.seasons_wrapper, tag='p', text=True, recursive=False) title = scraper_lib.Element(block='', el_tag='span', get_text=True) seasons_block = season_container.get_container() for i, season_block in enumerate(seasons_block): title.block = season_block season_title = title.get_element() season = Season(title=season_title, season_no=i) self.seasons_lst.append(season) return self.seasons_lst
def __get_post_info(self, fpt_post): post_title = scraper_lib.Element(block=fpt_post, el_tag="div", el_class="box-link-serie-bottom", get_text=True).get_element() post_ref_url = scraper_lib.Element(block=fpt_post, el_tag="a", el_class="box-link-serie", el_property="href").get_element() image = "n.d." return {"title": post_title, "url": post_ref_url, "image": image}
def get_episodes_by_season_number(self, season_no): #return all episodes of that season self.get_all_seasons() if len(self.seasons_lst) > 0: try: season_obj = self.seasons_lst[season_no] except IndexError: season_obj = self.seasons_lst[-1] if self.is_modern_state: #new version config seasons = scraper_lib.Container( self.seasons_wrapper, tag='div', container_class='accordion-item').get_container() s_title = scraper_lib.Element(block='', el_tag='ul', get_text=True) season_content = scraper_lib.Container( block='', tag='div', first=True, container_class='content') else: #old version config seasons = scraper_lib.Container( self.seasons_wrapper, tag='p', recursive=False).get_container() s_title = scraper_lib.Element(block='', el_tag='span', get_text=True) for season in seasons: try: s_title.block = season title = s_title.get_element() except: title = "nd" if title == season_obj.title: if not self.is_modern_state: content = scraper_lib.get_next_sibling(season) else: season_content.block = season content = season_content.get_container() all_episodes = self.get_all_episodes(content) return all_episodes return None
def get_search_result(self, keyword): movies_list = [] raw_keyword = keyword keyword = raw_keyword.replace(" ", "+") search_result = scraper_lib.get_page_soup(url=self.search_url.format( self.domain, keyword), check_result=True) if (search_result == -1): result_url = self.get_movie_url_from_google(keyword) search_result = scraper_lib.get_page_soup(url=result_url) movies = scraper_lib.Container( block=search_result, tag='div', container_class='col-lg-3 col-md-4 col-xs-4 mb-30').get_container( ) for movie in movies: movies_list.append(self.__get_post_info(movie)) if (not movies_list): try: title = scraper_lib.Element(block=search_result, el_tag='title', get_text=True).get_element() except: title = raw_keyword movie = Movie(title=title, page_url=result_url) movie.image_url = "n.d." movies_list.append(movie) return movies_list
def __get_iframe_page(self, seriehd_page): hdpass_iframe = scraper_lib.Element(seriehd_page, 'iframe', el_id='iframeVid').get_element() return scraper_lib.get_page_soup(url=hdpass_iframe["src"])
def get_playable_urls(self, block): urls = [] urls.append( scraper_lib.Element(block, el_tag="span", el_class="player-overlay", el_property="meta-embed").get_element()) urls.append( scraper_lib.Element(block, el_tag="span", el_class="player-overlay", el_property="meta-embed2").get_element()) return urls
def get_hdload_frame(self, title, movie_url): altadefinizione_page = scraper_lib.get_page_soup(movie_url) hdpass_iframe = scraper_lib.Element(altadefinizione_page, 'iframe', el_id='iframeVid').get_element() hdpass_iframe_url = hdpass_iframe["src"] return hdpass_iframe_url
def get_post_info(self, fpt_post, media_type): post_title = scraper_lib.Element(block=fpt_post, el_tag="div", el_class="title", get_text=True).get_element() post_ref_url = scraper_lib.Element(block=fpt_post, el_tag="a", el_property="href").get_element() image = scraper_lib.Element(block=fpt_post, el_tag="a", el_property="data-thumbnail").get_element() if media_type == "movie": movie = Movie(title=post_title, page_url=post_ref_url) movie.image_url = image return movie else: tvshow = TvShow(title=post_title, page_url=post_ref_url) tvshow.image_url = image return tvshow
def get_episode_info(self, tag, episode_number): episode_urls = [] if self.is_modern_state: episode_wrapper = scraper_lib.get_tag(tag, "ul") name = scraper_lib.Element(block=episode_wrapper, el_tag='li', el_class="episode_link", get_text=True) url = scraper_lib.Element(block=episode_wrapper, el_tag='a', el_class="myBtn", el_property="data-link") try: episode_name = name.get_element() episode_url = url.get_element() episode_urls.append(episode_url) #other links others_url = scraper_lib.get_hrefs( block=tag, filters=self.streaming_to_scrape) episode_urls = episode_urls + others_url except: episode_name = "nd" else: #old version try: soup = scraper_lib.get_soup(tag) episode_name = scraper_lib.get_previous_sibling(block=soup, tag='a') episode_name = self.replace_chars(episode_name) episode_urls = scraper_lib.get_hrefs( block=soup, filters=self.streaming_to_scrape) except: episode_name = "nd" episode = Episode(title=episode_name, urls=episode_urls, episode_no=episode_number) return episode
def __get_post_info(self, fpt_post): post_title = scraper_lib.Element(block=fpt_post, el_tag="div", el_class="infoSeries", get_text=True).get_element() post_ref_url = scraper_lib.Element(block=fpt_post, el_tag="a", el_property="href").get_element() try: image = scraper_lib.Element(block=fpt_post, el_tag="img", el_class="img-full", el_property="src").get_element() except: image = "n.d." tv_show = TvShow(title=post_title, page_url=post_ref_url) tv_show.image_url = image return tv_show
def __get_post_info(self, block): info_block = scraper_lib.Container(block=block, tag="h2", first=True).get_container() post_title = scraper_lib.Element(block=info_block, el_tag="a", get_text=True).get_element() post_ref_url = scraper_lib.Element(block=block, el_tag="a", el_property="href").get_element() try: image = scraper_lib.Element(block=block, el_tag="img", el_class="Thumbnail", el_property="src").get_element() except: image = "n.d." tvshow = TvShow(title=post_title, page_url=post_ref_url) tvshow.image_url = image return tvshow
def get_seasons(self, page): season_lst = [] seasons = scraper_lib.Container( page, tag="a", container_class="button-sel-serie").get_container() for i, season in enumerate(seasons, start=1): season_block = scraper_lib.Element( page, el_tag="div", el_class="row-stagione-{0}".format(i)).get_element() season_lst.append( Season(title="stagione: {0}".format(i), season_no=i, html_block=season_block)) return season_lst
def get_episodes(self, page): page = scraper_lib.get_soup(page) episodes = [] episodes_block = scraper_lib.Container( page, tag="a", container_class="box-link-serie").get_container() for i, episode_block in enumerate(episodes_block, start=1): urls = self.get_playable_urls(episode_block) episode_name = scraper_lib.Element(episode_block, el_tag="div", get_text=True).get_element() episodes.append( Episode(title=episode_name, urls=urls, episode_no=i)) return episodes
def play(title, streaming_url): streaming_source_name = kodiutilsitem.get_streaming_source_name( streaming_url) if streaming_source_name == "speedvideo": playable_url = speedvideo.get_stream_url(streaming_url) if streaming_url != '' and streaming_url != '404': kodiplayer.play_video(playable_url) else: kodiplayer.play_video_with_resolver(streaming_url) elif streaming_source_name == "vcrypt": page = scraper_lib.get_page_soup(url=streaming_url) mixdrop_url = scraper_lib.Element( page, 'iframe', ).get_element()["src"] mixdrop_obj = Mixdrop(mixdrop_url) kodiplayer.play_video(mixdrop_obj.get_final_url()) else: kodiplayer.play_video_with_resolver(streaming_url)
def get_embed_values_by_player(self, player_name): href = None if self.hdpass_page is None: self.hdpass_page = scraper_lib.get_page_soup(self.current_url) hosts = scraper_lib.Container(self.hdpass_page, 'div', container_class='hosts-bar', first=True).get_container() players = scraper_lib.Container(hosts, 'li').get_container() for player in players: if player_name == scraper_lib.get_text(player): a_href = scraper_lib.get_tag(player, 'a') href = a_href["href"].replace("amp;", "") break if href is not None: r = scraper_lib.get_page_soup(url=href) return scraper_lib.Element(r, 'iframe', el_property="custom-src").get_element() return None
def get_episodes(self, page_url, season_no=1): episodes_lst = [] block = scraper_lib.get_page_soup(page_url) episodes_container = scraper_lib.Container( block, tag="div", container_class="su-spoiler-content").get_container()[season_no - 1] episodes_block = scraper_lib.Container( episodes_container, tag="div", container_class="su-link-ep").get_container() for i, episode in enumerate(episodes_block, start=1): urls = [] ep_title = scraper_lib.get_text(episode).replace('\n', '').strip() urls.append( scraper_lib.Element(episode, el_tag="a", el_property="href").get_element()) episodes_lst.append( Episode(title=ep_title, urls=urls, episode_no=i)) return episodes_lst