Created
September 27, 2020 17:31
-
-
Save pagpeter/3402caf78ffc9a60651f6292428adf5c to your computer and use it in GitHub Desktop.
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 | |
from bs4 import BeautifulSoup | |
kino_url = "" | |
def search(movie): # this searches a kinox mirror, and returns the html | |
global kino_url | |
sites = ["http://kinox.to", "http://kinos.to", "http://kinox.tv", "http://kinox.me", "http://kinox.si", "http://kinox.io"] | |
for site in sites: | |
print(f"[*] trying to access {site}...") | |
try: | |
r = requests.get(f"{site}/Search.html?q={movie}") | |
if r.status_code == 200: | |
kino_url = site | |
print("[*] Successfull!") | |
return r.text | |
except: | |
next | |
print("coulnt find a reachable mirror.") | |
quit() | |
def video_from_streamtape(url): | |
r = requests.get(url) | |
if r.status_code == 200: | |
html = r.text | |
link = html.split('<div id="videolink" style="display:none;">//')[1].split("</div>")[0] | |
return link | |
else: | |
print("[*] Error getting the direct url. Use " + url) | |
def movies_from_html(html): # extract movie information from htmlm, returns dictionary | |
lines = html.split("\n") | |
try: | |
for line in lines: | |
if line.find('false;">') != -1: # if this is the html line with the title and stuff: | |
# extract the title and stuff | |
title = line.split('false;">')[1].split("</a>")[0] | |
year = line.split('"Year">')[1].split("</span>")[0] | |
url = line.split('<a href="')[1].split('" ')[0] | |
if line.find('"Rating">') != -1: # if this is the html line with the rating: | |
rating = line.split('"Rating">')[1].split("</td>")[0] | |
return { | |
"title": title, | |
"year": year, | |
"rating": rating, | |
"url": url | |
} | |
except UnboundLocalError: | |
print("[!] Couldnt find a movie matching your search /:") | |
quit() | |
def search_results(html): | |
movies = [] | |
movieHtml = html.split("</thead>\n<tbody>")[1].split("</tbody>\n</table>")[0] | |
moviesRaw = movieHtml.split("</tr>\n<tr>") | |
for movie in moviesRaw: | |
movies.append(movies_from_html(movie)) | |
return movies | |
def get_hosters(url): # get all avaible hosters from a movie-url | |
hosters = [] | |
r = requests.get(url) | |
if r.status_code == 200: | |
html = r.text.split('<ul id="HosterList" class="Sortable">')[1].split("</ul>")[0] | |
lines = html.split("\n") | |
for hoster in lines: | |
try: | |
if hoster != "": | |
hosterName = hoster.split('Named">')[1].split("</div>")[0] | |
date = hoster.split('Vom</b>: ')[1].split("</div>")[0] | |
ID = hoster.split('<li id="Hoster_')[1].split('" ')[0] | |
hosters.append({ | |
"hoster": hosterName, | |
"date": date, | |
"id": ID | |
}) | |
except: | |
print("[!] Error getting 1 hoster") | |
return hosters | |
else: | |
print("[*] Error") | |
def stream_url(movie, hoster): | |
url = f"{kino_url}/aGET/Mirror/{movie}&Hoster={hoster}" | |
r = requests.get(url) | |
# print(r.json()) | |
embed_url = r.json()['Stream'] | |
if embed_url.find("streamtap") != -1: | |
url = embed_url.split('<a href="')[1].split('"')[0] | |
url = url.replace('/v/', '/e/') | |
print(f"[*] Stream the movie at {url}") | |
print(f"[*] Direct url:\n{video_from_streamtape(url)}") | |
def good_hoster(hosters): # returns a good hoster from a list of hosters | |
for hoster in hosters: | |
if hoster["hoster"] == "Streamtape.com": | |
print("[*] Using Streamtape.com...") | |
return "102" | |
print("[!] Didnt found a good hoster") | |
print("[!] Cant extract a direct link. You have to watch it from kinox.to directly") | |
quit() | |
def list_movies(movies): | |
i = 0 | |
for x in movies: | |
i += 1 | |
print(f""" | |
[{i}] {x['title']} | |
rating: {x['rating']} | |
year: {x['year']} | |
url: {kino_url}{x['url']}""") | |
def list_hosters(hosters): | |
i = 0 | |
for x in hosters: | |
i += 1 | |
print(f""" | |
[{i}] Name: {x['hoster']} | |
Date: {x['date']} | |
ID: {x['id']}""") | |
### Search for a movie | |
movies = search_results(search(input("[?] movie?\n"))) | |
### Choose a movie | |
print(f"[*] found {len(movies)} movies. What movie do you want to choose?") | |
list_movies(movies) | |
movie = movies[int(input("[?] input the movie number\n"))-1] | |
movie_url = kino_url+movie['url'] | |
### Getting and choosing hoster | |
print(f"Ok, getting mirrors from {movie_url}...") | |
hosters = get_hosters(movie_url) | |
print(f"[*] Found {len(hosters)} avaible hosters.") | |
hoster = good_hoster(hosters) | |
movie_name = movie["url"].split("am/")[1].split(".html")[0] | |
if hoster == "102": | |
stream_url(movie_name, hoster) # get the data about the stream | |
else: | |
list_hosters(hosters) | |
hosterId = input("[?] input the hoster number\n") | |
stream_url(movie_name, str(hosterId)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use this script to get german movies fast!