Skip to content

Instantly share code, notes, and snippets.

@antiops
Last active February 5, 2023 08:19
Show Gist options
  • Save antiops/3e462a8c3ad6d29ae9aabbe420142236 to your computer and use it in GitHub Desktop.
Save antiops/3e462a8c3ad6d29ae9aabbe420142236 to your computer and use it in GitHub Desktop.
Revry.tv Notes

Movie

Example getting the video sources for https://watch.revry.tv/player/35033/stream

Extract ID from URL

URL_ID = 35033

Request general details from API & extract the stream ID

  • This include the media type (movie/series)
    • type: stream is paywall

MEDIA_TYPE = .data.asset.type

STREAM_ID = .data.asset.streams[0].id = 9747

  • The type must be stream and not trailer
  • If it has DRM the encryption value wont be open

Get the stream details to build the video sources API request

VIDEO_ID = .data.stream.url = 6250425244001 ACCOUNT_ID = .data.stream.video_provider_details.account_id = 6122285389001 ADS_VALUE = .data.stream.ads.parameters[0].value = 23644649-7957-44a1-8a40-cdd4ac2ef7bd

AUTH_KEY = .data.stream.video_provider_details.policy_key

Get the video sources information (and other metadata)

  • Layout: https://edge.api.brightcove.com/playback/v1/accounts/[ACCOUNT_ID]/videos/[VIDEO_ID]?ad_config_id=[ADS_VALUE]
  • With header Accept: application/json;pk=[AUTH_KEY]

Example:

curl 'https://edge.api.brightcove.com/playback/v1/accounts/6122285389001/videos/6250425244001?ad_config_id=23644649-7957-44a1-8a40-cdd4ac2ef7bd' \
  -H 'Accept: application/json;pk=BCpkADawqM1Zv6-iG7AM7iMe8KpHTYakNLvss4IkIoRJS9d1X6bcz0wCVP8J6vVPOKGz52R7ED6dIhrk6VjW_cKQPeZE4IGCwXsdfsQt2g_FdgOUhRHegg85b-_Uh9P9n3SdbrSDf55WF71g' \
  -H 'Referer: https://watch.revry.tv/' \
  | jq .

SOURCES = .sources

  • Contains m3u8 and mpd playlists & the content.vmap that has the ad placements times

Metadata: poster = .thumbnail or .thumbnail_sources[] banner = .poster or .posrt_sources[] title = .name description = .description or .long_description

#!/bin/bash
# https://watch.revry.tv/player/35033/stream
URL=$1
URL_ID=$(echo "$URL" | sed -E 's/^.*player\/(.*)\/stream.*$/\1/')
INFO_API=$(curl -fsSL "https://beacon.playback.api.brightcove.com/revry/api/assets/$URL_ID?device_type=web&device_layout=web&asset_id=$URL_ID")
STREAM_ID=$(jq -r '.data.asset.streams[0].id' <<< ${INFO_API})
MEDIA_TYPE=$(jq -r '.data.asset.type' <<< ${INFO_API})
echo "Type of Media: $MEDIA_TYPE"
STREAM_API=$(curl -fsSL "https://beacon.playback.api.brightcove.com/revry/api/assets/$URL_ID/streams/$STREAM_ID?device_type=web&device_layout=web")
VIDEO_ID=$(jq -r '.data.stream.url' <<< "${STREAM_API}")
ACCOUNT_ID=$(jq -r '.data.stream.video_provider_details.account_id' <<< "${STREAM_API}")
ADS_VALUE=$(jq -r '.data.stream.ads.parameters[0].value' <<< "${STREAM_API}")
AUTH_KEY=$(jq -r '.data.stream.video_provider_details.policy_key' <<< "${STREAM_API}")
# Get playlists and metadata
VIDEO_API=$(curl -fsSL "https://edge.api.brightcove.com/playback/v1/accounts/$ACCOUNT_ID/videos/$VIDEO_ID?ad_config_id=$ADS_VALUE" -H "Accept: application/json;pk=$AUTH_KEY" -H "Referer: https://watch.revry.tv/")
TITLE=$(jq -r '.name' <<< "${VIDEO_API}")
DESCRIPTION=$(jq -r '.long_description' <<< "${VIDEO_API}")
POSTER=$(jq -r '.thumbnail' <<< "${VIDEO_API}")
BANNER=$(jq -r '.poster' <<< "${VIDEO_API}")
SOURCES_HTTPS=$(jq -r '.sources[].src' <<< "${VIDEO_API}" | grep '^https')
echo "===================================================================================================="
echo "URL: $URL"
echo "Title: $TITLE"
echo "Description: $DESCRIPTION"
echo "Poster Image: $POSTER"
echo "Banner Image: $BANNER"
echo "==================================================================================================="
echo "Sources:"
echo "$SOURCES_HTTPS"
echo "==================================================================================================="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment