Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- from tkinter import scrolledtext, ttk
- import subprocess
- import webbrowser
- from imdb import IMDb
- # Dictionary to store the movie sites and their corresponding URLs
- movie_sites = {
- "Zoechip": "https://www3.zoechip.com/search/",
- "Onionplay": "https://onionplay.se/search/",
- "Showbox": "https://www.showbox.media/search?keyword=",
- "IMDb": "https://www.imdb.com/find/?q=",
- "PutLockers": "https://putlockers.vg/search?q=",
- "TubiTV": "https://tubitv.com/search/",
- "YouTube": "https://www.youtube.com/results?sp=mAEB&search_query=",
- "M4ufree+.html": "https://m4ufree.vip/search/",
- }
- def search_movies():
- keyword = entry_search.get()
- ia = IMDb()
- movies = ia.search_movie(keyword)
- result_text.delete('1.0', tk.END)
- if not movies:
- result_text.insert(tk.END, "No results found.")
- else:
- for movie in movies[:10]: # Displaying the first 10 results
- title = movie['title']
- year = movie.get('year', 'N/A') # Get the year if available, otherwise use 'N/A'
- result_text.insert(tk.END, f"{title} ({year})\n")
- if 'imdb_id' in movie:
- link = f"https://www.imdb.com/title/{movie['imdb_id']}/"
- result_text.insert(tk.END, f"Link: {link}\n\n")
- else:
- result_text.insert(tk.END, "\n")
- def open_browser():
- selected_text = result_text.tag_ranges(tk.SEL)
- if selected_text:
- selected_movie_link = result_text.get(*selected_text).strip()
- selected_movie_site = movie_site_combobox.get() # Get the selected movie site from the combobox
- if selected_movie_link.startswith("http://") or selected_movie_link.startswith("https://"):
- webbrowser.open(selected_movie_link)
- else:
- # Get the URL corresponding to the selected movie site
- movie_site_url = movie_sites.get(selected_movie_site)
- if movie_site_url:
- # Construct the full URL with the selected movie title
- full_url = f"{movie_site_url}{selected_movie_link}" #.html
- webbrowser.open(full_url)
- # GUI
- root = tk.Tk()
- root.title("Movie Search")
- # Define colors
- background_color = '#333333'
- text_color = '#FFFFFF'
- button_color = '#4CAF50'
- button_text_color = '#FFFFFF'
- root.config(bg=background_color)
- frame_search = tk.Frame(root, bg=background_color)
- frame_search.pack(pady=10)
- label_search = tk.Label(frame_search, text="Enter Movie Name:", bg=background_color, fg=text_color)
- label_search.pack(side=tk.LEFT)
- entry_search = tk.Entry(frame_search, width=30)
- entry_search.pack(side=tk.LEFT)
- button_search = tk.Button(frame_search, text="Search", command=search_movies, bg=button_color, fg=button_text_color)
- button_search.pack(side=tk.LEFT, padx=10)
- frame_result = tk.Frame(root, bg=background_color)
- frame_result.pack(pady=10)
- result_text = scrolledtext.ScrolledText(frame_result, width=50, height=20, bg=background_color, fg=text_color)
- result_text.pack(side=tk.LEFT)
- frame_options = tk.Frame(root, bg=background_color)
- frame_options.pack(pady=10)
- # Dropdown for selecting movie site
- label_site = tk.Label(frame_options, text="Select Movie Site:", bg=background_color, fg=text_color)
- label_site.pack(side=tk.LEFT)
- movie_site_combobox = ttk.Combobox(frame_options, values=list(movie_sites.keys()), state="readonly")
- movie_site_combobox.pack(side=tk.LEFT, padx=10)
- movie_site_combobox.current(0) # Set default value
- button_open_browser = tk.Button(frame_options, text="Open in Browser", command=open_browser, bg=button_color, fg=button_text_color)
- button_open_browser.pack(side=tk.LEFT)
- root.mainloop()
Add Comment
Please, Sign In to add comment