Upload files to ''
This commit is contained in:
parent
cfa5e1e0a5
commit
4eadcb8539
36
vidsrclinkgen.py
Normal file
36
vidsrclinkgen.py
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
try:
|
||||||
|
import requests
|
||||||
|
except ImportError:
|
||||||
|
print("You need to install 'requests'! Open up command prompt, jam in 'pip3 install requests' and hit enter!")
|
||||||
|
import webbrowser
|
||||||
|
import time
|
||||||
|
from requests.exceptions import HTTPError
|
||||||
|
title = input("Enter the title: ")
|
||||||
|
type = input("TV or Movie?: ")
|
||||||
|
typeparsed = ""
|
||||||
|
# grug brain can't figure out how to read string as capitalized
|
||||||
|
if type in ["T", "TV", "TV SHOW", "t", "tv", "tv show"]:
|
||||||
|
typeparsed = "T"
|
||||||
|
elif type in ["M", "MOVIE", "m", "movie"]:
|
||||||
|
typeparsed = "M"
|
||||||
|
|
||||||
|
if typeparsed == "T":
|
||||||
|
ep = input("Which episode? SeasonNumber-EpisodeNumber (Example: 2-8)")
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
|
response = requests.get('https://www.omdbapi.com/?t=' + title.replace(" ", "+") + '&apikey=e5c6c48f&')
|
||||||
|
response.raise_for_status()
|
||||||
|
jsonResponse = response.json()
|
||||||
|
seriestype = jsonResponse["Type"]
|
||||||
|
|
||||||
|
if seriestype == "series":
|
||||||
|
webbrowser.open('https://vidsrc.me/embed/'+ jsonResponse["imdbID"] + '/' + ep + '/')
|
||||||
|
|
||||||
|
elif seriestype == "movie":
|
||||||
|
webbrowser.open('https://vidsrc.me/embed/'+ jsonResponse["imdbID"] + '/')
|
||||||
|
|
||||||
|
except Exception as err:
|
||||||
|
print("An error has occured! Try typing the title differently!")
|
||||||
|
time.sleep(10)
|
Loading…
Reference in a new issue