nandyalu / trailarr

Trailarr is a Docker application to download and manage trailers for your Radarr and Sonarr libraries.
GNU General Public License v3.0
107 stars 7 forks source link

[Request] Use themoviedb.org as source for download #58

Open VampiricAlien opened 2 weeks ago

VampiricAlien commented 2 weeks ago

First off, thank you for creating this!

Using an API key, themoviedb allows downloading of trailers. This can be a good source if Youtube is blocked or/also cuts down on converting as trailers are in x264.

https://developer.themoviedb.org/reference/movie-videos

nandyalu commented 2 weeks ago

themoviedb.org only provides a youtube trailer id, which is already in Radarr, and Trailarr uses that by default.

Hello-World-Traveler commented 2 weeks ago

Could Apple trailers be used? https://tv.apple.com/us/room/edt.item.64248313-7414-4d63-a6fc-7c29f9916c79 Haven't use this https://github.com/dropcreations/Manzana-Apple-TV-Plus-Trailers

nandyalu commented 1 day ago

I looked at the code for Apple TV+ trailers download from that script, it looks complicated... so it takes significant effort to add that. Do you think it's worth it?

Hello-World-Traveler commented 19 hours ago

It's a dedicated source that could be better. Maybe it's something to add for a later date?

nandyalu commented 19 hours ago

Trailarr uses yt-dlp to download videos from YouTube, and yt-dlp supports downloading from appletrailers as well as many other sites, so this can be added. However, searchiproblema trailer is going to be a problem that needs to be solved. The other script to download apple trailers also doesn't provide a method for searching, you need to enter the URL to download.

Hello-World-Traveler commented 16 hours ago

The link makes it more complex then just /move I had a little go but failed.

This adds movie-ID to the link but doesn't find the second part of the link. I used https://tv.apple.com/us/movie/2073/ umc.cmc. 3ueoyn66rvue7 1zbahr61wntb as example (link has spaces in it)

`def construct_movie_url(movie_id):
    """Construct the URL for the given movie ID."""
    base_url = "https://tv.apple.com/us/movie/"
    return f"{base_url}{movie_id}"

def main():
    # Prompt the user for a movie ID (e.g., "2070")
    movie_id = input("Enter the movie ID you want to search for: ").strip().lower()

    # Construct the full URL
    movie_url = construct_movie_url(movie_id)

    # Output the constructed URL
    print(f"Movie page URL: {movie_url}")

if __name__ == "__main__":
    main()`

You might be able to do something with this as it doesn't work.

import requests
from bs4 import BeautifulSoup

def fetch_valid_movie_url(movie_id):
    """Fetch the valid movie URL based on the provided movie ID."""
    # Construct the search URL
    search_url = f"https://tv.apple.com/us/movie/{movie_id}"

    # Send a request to fetch the page content
    response = requests.get(search_url)

    if response.status_code != 200:
        return None  # Return None if the page is not found

    soup = BeautifulSoup(response.content, 'html.parser')

    # Look for a specific pattern in the page that contains the valid link
    # This assumes that there's a specific tag or attribute that holds the valid link
    # Check for all links on the page
    movie_links = soup.find_all('a', href=True)

    for link in movie_links:
        # Check if this link contains a valid structure for Apple TV movies
        if "/movie/" in link['href']:
            return f"https://tv.apple.com{link['href']}"

    return None

def main():
    # Prompt the user for a movie ID (e.g., "2070")
    movie_id = input("Enter the movie ID you want to search for: ").strip().lower()

    # Fetch the full movie URL
    movie_url = fetch_valid_movie_url(movie_id)

    if movie_url:
        print(f"Valid Movie page URL: {movie_url}")
    else:
        print(f"No valid movie found for ID '{movie_id}'.")

if __name__ == "__main__":
    main()

Could possibly use https://vimeo.com/ or https://www.fandango.com

for Fandango I looked at https://www.fandango.com/deadpool-and-wolverine-2024-234516/movie-overview and found prodamdfandango.akamaized net/out/v1/8ec5a20b02fe42b3ab0b90e1cd6a1d65/bb1afde999d842e4a4fae6dfa334d0c1/636c09373f7d4bf1ada4e5ad7d33070a/903a74700ade430a99b17d192ed789f4/index_7_1.ts as url.