Skip to content

Instantly share code, notes, and snippets.

@thedivtagguy
Last active June 3, 2025 12:58
Show Gist options
  • Save thedivtagguy/9644a18226b968cef6716a9147c812b0 to your computer and use it in GitHub Desktop.
Save thedivtagguy/9644a18226b968cef6716a9147c812b0 to your computer and use it in GitHub Desktop.
Scraping the MovieOfTheNight Catalog

Python script to scrape movie/series data from Movie of the Night API. I don't know if this gets EVERYTHING but it will make the best effort to. We're not using the official API but scraping movies that are loaded in the catalog pages on the web UI, so this won't contain all metadata that you might normally get. To get metadata, try joining this with TMDB data.

Usage

python scraper.py

Configuration

Edit these variables at the top of the script:

GENRES = ["scifi"]  # Single genre or list of genres
SHOW_TYPE = "movie"  # "movie" or "series"
ORDER_BY = "rating"  # "rating", "popularity_1year", "popularity_1month"
CATALOG = "netflix.subscription"  # See catalogs below
COUNTRY = "us"  # See countries below
MIN_YEAR = "2000"  # Year string or None for all years
LIMIT = 100  # Items per page (max 100)

Options

Genres: action, adventure, animation, comedy, crime, documentary, drama, family, fantasy, history, horror, music, mystery, reality, romance, scifi, talk, thriller, war, western

Catalogs: netflix.subscription, hulu.subscription, disney.subscription, amazon.prime, hbo.subscription, apple.subscription

Countries: us, ca, gb, au, de, fr, es, it, br, mx, jp, kr, in

Creates JSON file: motn_[genre/all]_[type]_[catalog]_[timestamp].json

Sample Output

  {
            "id": 1187,
            "title": "Resident Evil",
            "verticalPoster": {
              "w154": "https://image.tmdb.org/t/p/w154/rmLvn4w4HMdxobPkjmIqrhJiXDO.jpg",
              "w185": "https://image.tmdb.org/t/p/w185/rmLvn4w4HMdxobPkjmIqrhJiXDO.jpg",
              "w342": "https://image.tmdb.org/t/p/w342/rmLvn4w4HMdxobPkjmIqrhJiXDO.jpg",
              "w500": "https://image.tmdb.org/t/p/w500/rmLvn4w4HMdxobPkjmIqrhJiXDO.jpg",
              "w780": "https://image.tmdb.org/t/p/w780/rmLvn4w4HMdxobPkjmIqrhJiXDO.jpg"
            },
            "horizontalPoster": {
              "w360": "https://cdn.movieofthenight.com/show/1187/poster/horizontal/en/360.jpg?Expires=1769231295&Signature=O1PFnvVu-3PtwWfTRF3G7vpWdxss8Pm91n4Ha2O~yDjXqXL4QZdWwtplJHdrc4erJMdNUg-8jAC2RKVs2xLUwFHeT07E~AG3Zsk7mlBDfsm~nga0S6wI4pH8WMQck5toNx7oFoqMJ7AuC5J7dXFzZ0mJoCmhhX4aLiBd6Thj-fs2K~6kJC2HM6RyybyReZTv4tYAuejNofwbiDXmbWlAGGYK6HjpZrQdquCcr1GA8U-ixA1QPFnOZcKvbSr6Fcr2Mm8vRPbOmOon3que2eSzXDRFfjSYrhJw4BhMITqIK3ub3tAl2e0lLGbcTQ7ADXOqBc2bFHUMMLG69ne4SHFqvQ__&Key-Pair-Id=KK4HN3OO4AT5R",
              "w480": "https://cdn.movieofthenight.com/show/1187/poster/horizontal/en/480.jpg?Expires=1769231295&Signature=ca0DYYJtimcyv0EuXF7XVIypjpeDGKT8DhR2JKXSwX11kym9IDiq4-27lFoHI7BByb1TtPS46z3HjCu0A2~genWLbkhUkM0rPNLKd5N7RTey2z25YbpLio5DOGsmU64wfLCvbchuLXpAnCa5kv2SH2R6h5MfKnT-VaARkWnj-lFeyCG-Q3FmJIIoo3cYrZDe0MNlpgJXhFywXUnBK7bM8oKYSa3i~piBxgIRKLicIaBib2XrvHx3d1P3eqaM5nK0ejgudUg37koZsdLI7UnfxhiCVDJg1wI8JJPyxyZTpv-S3zYh7omstPi2jrIFXnNHsOvrJpWUAR3RSuAKGbb8QA__&Key-Pair-Id=KK4HN3OO4AT5R",
              "w720": "https://cdn.movieofthenight.com/show/1187/poster/horizontal/en/720.jpg?Expires=1769231295&Signature=RtG53nIzI0YmXItWAmEaNzZpIPj~sYKCNc~9FMeIFSzNhdBvrWXac9crAWQ9dWDd5KCfuCgHeTPX6ARHENChA60vcxpGk5Lqx0ry-JHF2jvXRnCfCmVcJABk6TrH~A1brpLrzHPr8f2UlrpU95q6gVBiG3y1v59L7QsqdFL-yieIXGhK8BG8W5BIsf2jTJVmmbgo3qr8t54YWJvMal1fG6Bv22RjjaV0OWzV3RViY6~nuZLs5NhLZ5zSHOTRtfRI~0KGxP77--dcnVxdxADalxirZe5exkmyR-sBrDyaGLs8KzVsZ5YOPp2s1445tPB8ybEbdYfvYe2ZkpJljMthCw__&Key-Pair-Id=KK4HN3OO4AT5R",
              "w1080": "https://cdn.movieofthenight.com/show/1187/poster/horizontal/en/1080.jpg?Expires=1769231295&Signature=F7ru7ueWjIlyYcAe4PUOlvQxF0zdTKBAVizFxLhshUE8EbLfXI0gNe5Ray0NRu1JY~Q-VBmC4XmftrHd8KcB5Rut4i5xTR61U866drJYO1DALY6rYQJ4zRYc2aI41qOR5bWEU055AYa5gQdGIQeFG0Hy6EdQInqmtYAU0tuOlm22chl5frwkEwk6fQDc9bwQMlng7leDI1IM85r~9YkUjb5TNJqsReg~xNJMU5oUwBWgCSqiWLrOzUQcrQhcZbqwvGSkJvuKC3vDis216THQ8okvlNY91l4Vno99zOgskK~1w1R5Bsx~ntH-WqLvYpM63NOnFOV4wfvCeyNfszJgrQ__&Key-Pair-Id=KK4HN3OO4AT5R",
              "w1440": "https://cdn.movieofthenight.com/show/1187/poster/horizontal/en/1440.jpg?Expires=1769231295&Signature=TOVtPPVFb3-7OmuGR-ouLRJ1Dz9Bl~XGSM2pq7RtLK5MSqzBqOBHnCmF~K6EFMUITmjrNfD6pHsWXXtU-pnx6ckSvunfaCqjvw43xJAT8lzxqU72H~YUIGZffweZDBVQV8AaYP5b9~Wz9kh3-GGPwpAdOFVZwo10HvOmvEc3ZA0sIzMuKRvkTrBEnuvEqSgkEwX8h5J3aHuGHddxfGnBO8NKPQ-9z8UyUKQoDz0~85TYzoGOAwUmKQJvvHxV6YWYjsYM0yESn0NJAJYqlyW-shWGs--NzYH46B3tYz9OvQ~mOMXLqXQsJgTHfqW-2Bl1QaXa~9dtLzA5-grQFUBpOQ__&Key-Pair-Id=KK4HN3OO4AT5R"
            },
            "horizontalBackdrop": {
              "w300": "https://image.tmdb.org/t/p/w300/tPwRAc8Hu4Ose3G2qvrziWAEfIc.jpg",
              "w780": "https://image.tmdb.org/t/p/w780/tPwRAc8Hu4Ose3G2qvrziWAEfIc.jpg",
              "w1280": "https://image.tmdb.org/t/p/w1280/tPwRAc8Hu4Ose3G2qvrziWAEfIc.jpg",
              "w1440": "https://image.tmdb.org/t/p/original/tPwRAc8Hu4Ose3G2qvrziWAEfIc.jpg"
            },
            "rating": 45,
            "isSeries": true,
            "firstReleaseYear": 2022,
            "lastReleaseYear": 2022,
            "seasons": 1,
            "episodes": 8,
            "genres": [
              "action",
              "horror",
              "scifi"
            ],
            "overview": "Nearly three decades after the discovery of the T-virus, an outbreak reveals the Umbrella Corporation's dark secrets. Based on the horror franchise."
  }
import requests
import json
import time
import os
# Configuration
URL = "https://test.movieofthenight.com/api/v2/catalog/bulk"
HEADERS = {
"Content-Type": "application/json",
"X-Motn-Language": "en",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:139.0) Gecko/20100101 Firefox/139.0"
}
GENRES = ["action", "adventure", "animation", "comedy", "crime", "documentary",
"drama", "family", "fantasy", "history", "horror", "music", "mystery",
"reality", "romance", "scifi", "talk", "thriller", "war", "western"]
SHOW_TYPE = "movie"
ORDER_BY = "rating"
CATALOG = "netflix.subscription"
COUNTRY = "us"
MIN_YEAR = "2000"
LIMIT = 100
def make_request(genre, cursor=None):
params = {
"orderBy": ORDER_BY,
"showType": SHOW_TYPE,
"andGenres": genre,
"catalogs": CATALOG,
"country": COUNTRY,
"minYear": MIN_YEAR,
"limit": str(LIMIT)
}
if cursor:
params["cursor"] = cursor
action = {
"id": os.urandom(16).hex(),
"type": "searchByFilters",
"params": params
}
try:
response = requests.post(URL, json={"actions": [action]}, headers=HEADERS, timeout=30)
if response.status_code == 200:
return response.json()
else:
print(f"Error {response.status_code}")
return None
except Exception as e:
print(f"Request failed: {e}")
return None
def scrape_genre(genre):
all_pages = []
page_num = 1
cursor = None
while True:
print(f"Scraping {genre} page {page_num}...")
data = make_request(genre, cursor)
if not data:
break
all_pages.append(data)
# Check if there are more pages
batch = data[0]
result = batch["result"]
has_more = result.get("hasMore", False)
cursor = result.get("nextCursor")
if not has_more or not cursor:
break
page_num += 1
time.sleep(0.5) # Be nice to the server
return all_pages
def main():
all_data = {}
# Scrape each genre
for genre in GENRES:
print(f"\n--- Starting {genre} ---")
all_data[genre] = scrape_genre(genre)
# Save to file
timestamp = int(time.time())
filename = f"motn_{SHOW_TYPE}_{CATALOG.split('.')[0]}_{timestamp}.json"
with open(filename, "w") as file:
json.dump(all_data, file, indent=2)
# Count total items
total_items = 0
for genre_data in all_data.values():
for page in genre_data:
batch = page[0]
items = batch["result"]["items"]
total_items += len(items)
print(f"\nDone! Total {SHOW_TYPE}s: {total_items}")
print(f"Saved to: {filename}")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment