Movie & Web Show Cast Search

Movie & Web Show Cast Search

Movie & Web Show Cast Search

Movie & Show Cast Search

ЁЯОм Movie & Web Show Cast Search

Searching Wikipedia… Please wait.

Enter a movie or TV show title above to find its cast and a photo!

This webpage allows you to search for movies and web shows and retrieve their cast information and a relevant photo from Wikipedia.

Here’s how it works:

  • Search Input: Type the name of a movie or TV show into the input field.
  • Search Button: Click the “Search” button (or press Enter) to initiate the search.
  • Wikipedia API: The app uses the official Wikipedia API to:
    1. Find the relevant page: It first searches for the most relevant Wikipedia page based on your query.
    2. Fetch content and image: It then retrieves the introductory summary (extract) of the page and a main thumbnail image.
  • Cast Extraction: It attempts to extract cast information from the summary text using a heuristic search for common keywords like “starring” or “cast.” While this isn’t a perfect method for a structured cast list (as Wikipedia’s API doesn’t provide a dedicated “cast” field in this simplified use case), it often provides good results from the introductory paragraph.
  • Display Results: The movie/show title, extracted cast, image, and a link to the full Wikipedia page are displayed. A placeholder image is shown if no image is found.
  • Loading Indicator & Error Handling: A loading message appears during the search, and appropriate error messages are displayed if no results are found or if an API error occurs.

Feel free to give it a try with your favorite movies or shows! Let me know if you’d like to explore more advanced features or different data sources.

Key Changes and New Features:


1. Enhanced Search for Movies & Web Shows ЁЯОмЁЯУ║

  • The search query to Wikipedia has been updated to be more inclusive. It now explicitly searches for pages that might be disambiguated as (film), (TV series), (television series), or (web series). This helps in finding more accurate results for both movies and web shows.
  • The placeholder text in the input field has been updated to e.g., Inception or The Office to guide the user.

2. Improved Image Extraction from Wikipedia ЁЯУ╕

  • The extractImageFromWikipediaHtml function has been significantly improved. It now attempts to:
    1. Find an image directly within the infobox of the Wikipedia page.
    2. If an infobox image isn’t found, it looks for the first general image on the page (e.g., within a thumbnail or gallery).
    3. New Fallback: If no image is found in the HTML, it now makes an additional API call to Wikipedia’s imageinfo module using the pageImages data (which lists images on the page). This allows it to get the direct URL for a potentially relevant image (like a poster or series logo).
  • The md5 placeholder function has been removed as it’s no longer needed with the imageinfo API call, which directly provides the image URL.
  • The onerror attribute on the <img> tag ensures that a “No Photo” placeholder is shown if the extracted image URL fails to load.

3. Smarter Similar Suggestions ЁЯза

  • The suggestSimilarMovies function now dynamically adjusts its prompt to the Gemini API based on whether the searched title appears to be a “film” or “web show” (by checking if (film) is in the page title). This helps the LLM provide more relevant suggestions (e.g., “similar movies” vs. “similar web shows”).

This updated version provides a more robust and intelligent way to get information and recommendations for both movies and web shows directly from Wikipedia, enhanced by the power of the Gemini API!

Feel free to try searching for both movies (e.g., “Interstellar”) and web shows (e.g., “The Office” or “Stranger Things”) to see the new features in action! Let me know if you have any other ideas!

Leave a Reply

Your email address will not be published. Required fields are marked *