Last active
April 5, 2021 04:44
-
-
Save MayankFawkes/09fc4a1da9047737761201df0c69b887 to your computer and use it in GitHub Desktop.
Indian shows script watch before anyone. working in ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests, re | |
| from subprocess import run | |
| class Shows: | |
| showl_list = { | |
| "Shaurya Aur Anokhi Ki Kahani":"https://saathnibhanasaathiya2.com/shaurya-aur-anokhi-ki-kahani-grs/", | |
| "Ghum Hai Kisi Ke Pyar Mein":"https://saathnibhanasaathiya2.com/ghum-hai-kisi-ke-pyar-mein/", | |
| "Imlie":"https://saathnibhanasaathiya2.com/imlie-rthj/", | |
| "Anupama": "https://saathnibhanasaathiya2.com/anupama/", | |
| } | |
| days = { | |
| "Latest": 1, | |
| "Day before Today": 2, | |
| "Overmorrow": 3 | |
| } | |
| def __init__(self, video_player:str="totem", show:int=0, day:int=1): | |
| self.video_player = video_player | |
| if show: | |
| self._play(show, day) | |
| for i, n in enumerate(self.showl_list): | |
| print(f"{i+1:<2}: {n}") | |
| show = int(input("--> ")) | |
| for i, n in enumerate(self.days): | |
| print(f"{i+1:<2}: {n}") | |
| day = int(input("--> ")) | |
| self._play(show, day) | |
| def _play(self, show:int, day:int): | |
| try: | |
| get_episode = self._get_eposides(list(self.showl_list.values())[show-1], first=day)[-1] | |
| print(f"[Playing] {get_episode[1]}") | |
| emded = self._get_embed_from_episode(get_episode[0]) | |
| print(f"[Embed] {emded}") | |
| MediaUrl = self._url_from_embed(emded) | |
| print(f"[Media URL] {MediaUrl}") | |
| run([self.video_player, MediaUrl, "--gst-debug-level=0"]) | |
| except Exception as e: | |
| print(f"[ERROR] {e}") | |
| def _url_from_embed(self, url:str) -> str: | |
| VideoPattern = re.compile(fr"([0-9][0-9][0-9]p)\|(.*?)\|") | |
| UrlPattern = re.compile(r'<img src="(.*?)"') | |
| req = requests.get(url) | |
| code = re.findall(VideoPattern, req.text)[-1] | |
| print(f"[Quality] Found {code[0]} Streaming resolution") | |
| ImgUrl = re.findall(UrlPattern, req.text)[0] | |
| site = ImgUrl.split(".com")[0] + ".com" | |
| return f"{site}/{code[-1]}/v.mp4" | |
| def _get_eposides(self, url:str, first:int=3) -> tuple: | |
| Pattern = re.compile(r'<h2 class="post-box-title">\n\t\t\t<a href="(.*?)">(.*?)</a>\n\t\t</h2>') | |
| req = requests.get(url) | |
| code = re.findall(Pattern, req.text)[:first] | |
| return code | |
| def _get_embed_from_episode(self, url:str): | |
| Pattern = re.compile(r'<IFRAME SRC="(.*?).html') | |
| # Pattern = re.compile(r'<iframe src="(.*?).html" ') | |
| req = requests.get(url) | |
| code = re.findall(Pattern, req.text)[0] | |
| return f"{code}.html" | |
| if __name__ == '__main__': | |
| Shows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment