Reel de propiedad desde un enlace
En esta página
El mismo reel que el reel de propiedad con tus fotos, pero las fotos y los datos vienen de una página pública de un anuncio. Al terminar esta página conocerás las cuatro partes: una lectura de la página, una llamada que trae las fotos a tu cuenta, un paso opcional para mejorar la nitidez de las fotos pequeñas y luego el Timeline del reel de fotos.
Cuánto cuesta #
- La lectura: 2 créditos.
- Traer las fotos a tu cuenta: gratis.
- Mejorar la nitidez de una foto pequeña: 3 créditos por cada foto que elijas mejorar.
- El video: 15 créditos por cada 10 segundos iniciados del render final, como en el reel de propiedad.
Por ejemplo, una lectura, cuatro fotos mejoradas y un reel de 30 segundos suman 2 + 12 + 45 = 59 créditos, cerca de 0,60 US$.
Enviar la misma lectura otra vez con la misma clave de reintento dentro de 15 minutos devuelve la primera respuesta sin cobro.
Lee el anuncio #
oneup/web-read-listing es un modelo síncrono: lee una página pública de un anuncio de Zillow, Realtor.com, Redfin o FurnishedFinder y responde en la misma solicitud.
POST /v1/run/oneup/web-read-listing (Idempotency-Key) {"url": "https://www.zillow.com/homedetails/…"}
→ {"alias": "oneup/web-read-listing",
"output": {"facts": {"address", "price", "beds", "baths", "sqft"?}, "description",
"photos": [{"url", "width"?, "height"?}, …], "extraction_id": "oneup_extract_…"}}El extraction_id nombra esta extracción. Las fotos de la página llegan como direcciones, no como archivos.
- Cualquier otro sitio se rechaza antes de cobrar nada con
400 invalid_requestydetailunsupported_source, osource_not_ready:<source>para un sitio que conocemos pero todavía no podemos leer. - Una página a la que llegamos pero no podemos leer responde
422 invalid_inputcondetaillisting_unreadable; una página a la que no podemos llegar respondelisting_unreachable. Las dos se reembolsan. - Las lecturas de páginas, esta y el lector de artículos juntos, tienen un límite de 10 por minuto y 60 por día. Pasado eso, la respuesta es
429 rate_limitedconRetry-After.
Trae las fotos a tu cuenta #
Elige las direcciones de las fotos que quieres y envíalas con el id de la extracción. Solo se descargan direcciones de tu propia extracción, así que esta llamada no sirve para descargar nada más.
POST /v1/uploads/from-extraction {"extraction_id": "oneup_extract_…", "urls": [las urls de las fotos que conservas, 40 como máximo]}
→ {"uploads": [{"url", "upload_id", "file_url", "bytes", "content_type"}], "skipped": [{"url", "reason"}]}Hazlo dentro de la hora siguiente a la lectura; después la extracción se olvida y la respuesta es 400 invalid_request con detail extraction_unknown. Es gratis y se permite 5 veces por minuto. Los bytes cuentan para tu cuota de almacenamiento. Cada elemento de uploads es una subida normal. Una foto que no pudo traer aparece en skipped con un reason: not_in_extraction, storage_quota_exceeded, call_ceiling, source_gone, not_an_image, too_large, source_not_allowed o fetch_failed.
Mejora la nitidez de las fotos pequeñas (opcional) #
Para cada foto cuyo lado más corto mida menos de 1080 píxeles, puedes hacer una copia más nítida al doble de tamaño con oneup/image-upscale, un modelo en cola, por 3 créditos.
POST /v1/queue/submit/oneup/image-upscale (Idempotency-Key) {"image_url": "<el file_url de esa foto>"}
→ consulta el ticket → {"assets": [{"asset_id", "url", …}]}Luego usa {"$asset": "<asset_id>"} en el Timeline en lugar del id de la subida de esa foto.
Arma el reel #
El resto es igual que en el reel de propiedad: crea un Proyecto, guarda el Timeline del reel de fotos con los ids de tus subidas y recursos, haz una vista previa gratis y luego el render final.
POST /v1/projects {"agent_slug": "oneup/render-timeline"} → {"project_id"}
PUT /v1/projects/{project_id}/timeline {"timeline": <el Timeline del reel de fotos>} → {"version_id"}
POST /v1/renders (Idempotency-Key) {"alias": "oneup/render-timeline", "project_id", "version_id", "kind": "preview"}
POST /v1/renders (Idempotency-Key) {"alias": "oneup/render-timeline", "project_id", "version_id", "kind": "final"}
GET /v1/renders/{render_id} → {"status": "COMPLETED", "ticket", …}
GET /v1/queue/result/{ticket} → {"assets": [el MP4]}Ejecútalo #
Cada versión es un programa, que se muestra completo abajo y se puede descargar de la carpeta de ejemplos: run.sh (curl y jq), run.mts (Node.js 20 o más nuevo: npx tsx run.mts) y run.py (Python 3.8 o más nuevo: python3 run.py). Cada uno hace las llamadas de arriba en orden, imprime cada respuesta y se detiene en la primera llamada que se rechace. Dale la dirección de la página del anuncio, por ejemplo bash run.sh "https://www.zillow.com/homedetails/…".
#!/usr/bin/env bash
# Listing reel from a link: the photos and facts of a public listing page
# (Zillow, Realtor.com, Redfin or FurnishedFinder) become the photo reel. The
# read is 2 credits, bringing the photos in is free, each small photo
# sharpened is 2 credits, and the final is 15 credits for each started 10
# seconds (a 30-second reel: 45). The Preview is free.
# The calls of the page https://api.oneupai.com/docs/recipes/listing-from-link,
# in its order, as one program.
#
# export ONEUP_API_KEY="oneup_live_…" # your Builder key
# bash run.sh "https://www.zillow.com/homedetails/…"
#
# Needs curl, jq and uuidgen. ONEUP_BASE_URL changes the host (default
# https://api.oneupai.com). Every answer is printed as it arrives.
set -euo pipefail
: "${ONEUP_API_KEY:?Set ONEUP_API_KEY to your API key first}"
API=${ONEUP_BASE_URL:-https://api.oneupai.com}
LISTING=${1:?Give the listing page address as the first argument}
# One API call; the answer is printed and kept in OUT. A refusal stops here.
api() {
local method=$1 path=$2
shift 2
OUT=$(curl -sS -X "$method" "$API$path" \
-H "Authorization: Bearer $ONEUP_API_KEY" \
-H "Content-Type: application/json" "$@")
echo "$OUT"
if ! echo "$OUT" | jq -e 'type == "object" and (has("error") | not)' > /dev/null; then
echo "refused: $method $path" >&2
exit 1
fi
}
# Waits for a queued job (every 2 s for 30 s, then every 5 s) and leaves its
# result in OUT.
wait_for() {
local start=$SECONDS
api GET "/v1/queue/status/$1"
until echo "$OUT" | jq -e '.status == "COMPLETED" or .status == "FAILED"' > /dev/null; do
if [ $((SECONDS - start)) -lt 30 ]; then sleep 2; else sleep 5; fi
api GET "/v1/queue/status/$1"
done
api GET "/v1/queue/result/$1"
}
# Starts a render, waits for it, and leaves the finished render in OUT.
render() {
api POST /v1/renders -H "Idempotency-Key: $(uuidgen)" \
-d "$(jq -n --arg p "$PROJECT" --arg v "$VERSION" --arg k "$1" \
'{alias: "oneup/render-timeline", project_id: $p, version_id: $v, kind: $k}')"
local id
id=$(echo "$OUT" | jq -r .render_id)
until echo "$OUT" | jq -e '.status == "COMPLETED" or .status == "FAILED"' > /dev/null; do
sleep 5
api GET "/v1/renders/$id"
done
}
# 1. Read the listing (2 credits; the same retry key within 15 minutes
# returns the first answer without a charge).
api POST /v1/run/oneup/web-read-listing -H "Idempotency-Key: $(uuidgen)" \
-d "$(jq -n --arg u "$LISTING" '{url: $u}')"
LISTING_ANSWER=$OUT
ADDRESS=$(echo "$LISTING_ANSWER" | jq -r .output.facts.address)
DETAILS=$(echo "$LISTING_ANSWER" | jq -r '.output.facts | "\(.price) · \(.beds) bd · \(.baths) ba"')
# 2. Bring the photos into your account (free; within an hour of the read).
api POST /v1/uploads/from-extraction -d "$(echo "$LISTING_ANSWER" | jq -c \
'{extraction_id: .output.extraction_id, urls: [.output.photos[].url][:40]}')"
IMPORTED=$OUT
# 3. Sharpen each photo whose shorter side is under 1080 pixels (2 credits
# each), and use the sharper copy in its place.
SMALL=$(echo "$LISTING_ANSWER" | jq -c \
'[.output.photos[] | select(((.width // 1080) < 1080) or ((.height // 1080) < 1080)) | .url]')
PHOTOS='[]'
while read -r item; do
[ -n "$item" ] || continue
url=$(echo "$item" | jq -r .url)
source=$(echo "$item" | jq -r .upload_id)
if echo "$SMALL" | jq -e --arg u "$url" 'any(.[]; . == $u)' > /dev/null; then
api POST /v1/queue/submit/oneup/image-upscale -H "Idempotency-Key: $(uuidgen)" \
-d "$(echo "$item" | jq -c '{image_url: .file_url}')"
wait_for "$(echo "$OUT" | jq -r .ticket)"
source=$(echo "$OUT" | jq -r '.assets[0].asset_id')
fi
PHOTOS=$(echo "$PHOTOS" | jq -c --arg id "$source" '. + [$id]')
done <<< "$(echo "$IMPORTED" | jq -c '.uploads[]')"
if [ "$(echo "$PHOTOS" | jq length)" = 0 ]; then
echo "no photo could be brought in" >&2
exit 1
fi
# 4. The photo reel: each photo 3 s with a push-in or a pan, 0.4 s crossfades,
# a 4-second closing card, the address and price over the opening.
api POST /v1/projects -d '{"agent_slug": "oneup/render-timeline"}'
PROJECT=$(echo "$OUT" | jq -r .project_id)
TIMELINE=$(jq -n --argjson photos "$PHOTOS" --arg address "$ADDRESS" --arg details "$DETAILS" '
{
v: "1.1",
output: {aspect: "9:16", resolution: 1080, fps: 30, container: "mp4"},
segments: ([$photos | to_entries[] | {
id: "p\(.key + 1)",
source: {"$asset": .value},
duration: 3000,
effects: [if .key % 2 == 0
then {op: "kenburns", from: {x: 0.5, y: 0.5, zoom: 1}, to: {x: 0.5, y: 0.5, zoom: 1.18}, ease: "ease_in_out"}
else {op: "kenburns", from: {x: 0.58, y: 0.5, zoom: 1.18}, to: {x: 0.42, y: 0.5, zoom: 1.18}, ease: "ease_in_out"}
end],
transition_out: {op: "crossfade", duration: 400}
}]
+ [{id: "card", source: {"$asset": $photos[-1]}, duration: 4000,
effects: [{op: "fade", from: 1, to: 0, duration: 600}]}]),
overlays: [
{id: "t1", kind: "text", content: $address, style: "lower_third",
position: "middle", range: {from: 0, to: 3000},
enter: {op: "fade", duration: 250}, exit: {op: "fade", duration: 200}},
{id: "t2", kind: "text", content: $details, style: "lower_third",
position: "bottom", range: {from: 0, to: 3000}}
]
}')
api PUT "/v1/projects/$PROJECT/timeline" -d "$(jq -n --argjson t "$TIMELINE" '{timeline: $t}')"
VERSION=$(echo "$OUT" | jq -r .version_id)
# 5. A free Preview, then the final, then the MP4's link (good for an hour).
render preview
render final
api GET "/v1/queue/result/$(echo "$OUT" | jq -r .ticket)"// Listing reel from a link: the photos and facts of a public listing page
// (Zillow, Realtor.com, Redfin or FurnishedFinder) become the photo reel. The
// read is 2 credits, bringing the photos in is free, each small photo
// sharpened is 2 credits, and the final is 15 credits for each started 10
// seconds (a 30-second reel: 45). The Preview is free.
// The calls of the page https://api.oneupai.com/docs/recipes/listing-from-link,
// in its order, as one program.
//
// export ONEUP_API_KEY="oneup_live_…" # your Builder key
// npx tsx run.mts "https://www.zillow.com/homedetails/…" # Node.js 20+
//
// ONEUP_BASE_URL changes the host (default https://api.oneupai.com). Every
// answer is printed as it arrives.
const API = process.env.ONEUP_BASE_URL ?? "https://api.oneupai.com";
const KEY = process.env.ONEUP_API_KEY;
if (!KEY) throw new Error("Set ONEUP_API_KEY to your API key first");
const LISTING = process.argv[2];
if (!LISTING)
throw new Error("Give the listing page address as the first argument");
// One API call: the answer is printed and returned; a refusal stops here.
async function call(
method: string,
path: string,
body?: object,
headers?: Record<string, string>
) {
const res = await fetch(API + path, {
signal: AbortSignal.timeout(60_000),
method,
headers: {
Authorization: `Bearer ${KEY}`,
"Content-Type": "application/json",
...headers,
},
body: body && JSON.stringify(body),
});
const json = await res.json();
console.log(JSON.stringify(json));
if (!res.ok) throw new Error(`${res.status} ${json.error}: ${json.message}`);
return json;
}
const retryKey = () => ({ "Idempotency-Key": crypto.randomUUID() });
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
// Waits for a queued job (every 2 s for 30 s, then every 5 s); its result.
async function waitFor(ticket: string) {
const started = Date.now();
let status = await call("GET", `/v1/queue/status/${ticket}`);
while (status.status !== "COMPLETED" && status.status !== "FAILED") {
await sleep(Date.now() - started < 30_000 ? 2000 : 5000);
status = await call("GET", `/v1/queue/status/${ticket}`);
}
return call("GET", `/v1/queue/result/${ticket}`);
}
async function render(projectId: string, versionId: string, kind: string) {
let r = await call(
"POST",
"/v1/renders",
{
alias: "oneup/render-timeline",
project_id: projectId,
version_id: versionId,
kind,
},
retryKey()
);
const renderId = r.render_id;
while (r.status !== "COMPLETED" && r.status !== "FAILED") {
await sleep(5000);
r = await call("GET", `/v1/renders/${renderId}`);
}
return r;
}
// 1. Read the listing (2 credits; the same retry key within 15 minutes
// returns the first answer without a charge).
const listing = (
await call(
"POST",
"/v1/run/oneup/web-read-listing",
{ url: LISTING },
retryKey()
)
).output;
const { address, price, beds, baths } = listing.facts;
// 2. Bring the photos into your account (free; within an hour of the read).
type Photo = { url: string; width?: number; height?: number };
const photosOnPage: Photo[] = listing.photos;
const imported = await call("POST", "/v1/uploads/from-extraction", {
extraction_id: listing.extraction_id,
urls: photosOnPage.slice(0, 40).map((p) => p.url),
});
// 3. Sharpen each photo whose shorter side is under 1080 pixels (2 credits
// each), and use the sharper copy in its place.
const small = new Set(
photosOnPage
.filter((p) => (p.width ?? 1080) < 1080 || (p.height ?? 1080) < 1080)
.map((p) => p.url)
);
const photos: string[] = [];
for (const item of imported.uploads) {
if (!small.has(item.url)) {
photos.push(item.upload_id);
continue;
}
const job = await call(
"POST",
"/v1/queue/submit/oneup/image-upscale",
{ image_url: item.file_url },
retryKey()
);
const sharper = await waitFor(job.ticket);
photos.push(sharper.assets[0].asset_id);
}
if (!photos.length) throw new Error("no photo could be brought in");
// 4. The photo reel: each photo 3 s with a push-in or a pan, 0.4 s
// crossfades, a 4-second closing card, the address and price over the
// opening.
const project = await call("POST", "/v1/projects", {
agent_slug: "oneup/render-timeline",
});
const projectId = project.project_id;
const pushIn = {
op: "kenburns",
from: { x: 0.5, y: 0.5, zoom: 1 },
to: { x: 0.5, y: 0.5, zoom: 1.18 },
ease: "ease_in_out",
};
const pan = {
op: "kenburns",
from: { x: 0.58, y: 0.5, zoom: 1.18 },
to: { x: 0.42, y: 0.5, zoom: 1.18 },
ease: "ease_in_out",
};
const timeline = {
v: "1.1",
output: { aspect: "9:16", resolution: 1080, fps: 30, container: "mp4" },
segments: [
...photos.map((id, i) => ({
id: `p${i + 1}`,
source: { $asset: id },
duration: 3000,
effects: [i % 2 === 0 ? pushIn : pan],
transition_out: { op: "crossfade", duration: 400 },
})),
{
id: "card",
source: { $asset: photos[photos.length - 1] },
duration: 4000,
effects: [{ op: "fade", from: 1, to: 0, duration: 600 }],
},
],
overlays: [
{
id: "t1",
kind: "text",
content: address,
style: "lower_third",
position: "middle",
range: { from: 0, to: 3000 },
enter: { op: "fade", duration: 250 },
exit: { op: "fade", duration: 200 },
},
{
id: "t2",
kind: "text",
content: `${price} · ${beds} bd · ${baths} ba`,
style: "lower_third",
position: "bottom",
range: { from: 0, to: 3000 },
},
],
};
const version = await call("PUT", `/v1/projects/${projectId}/timeline`, {
timeline,
});
// 5. A free Preview, then the final, then the MP4's link (good for an hour).
await render(projectId, version.version_id, "preview");
const final = await render(projectId, version.version_id, "final");
await call("GET", `/v1/queue/result/${final.ticket}`);#!/usr/bin/env python3
# Listing reel from a link: the photos and facts of a public listing page
# (Zillow, Realtor.com, Redfin or FurnishedFinder) become the photo reel. The
# read is 2 credits, bringing the photos in is free, each small photo
# sharpened is 2 credits, and the final is 15 credits for each started 10
# seconds (a 30-second reel: 45). The Preview is free.
# The calls of the page https://api.oneupai.com/docs/recipes/listing-from-link,
# in its order, as one program.
#
# export ONEUP_API_KEY="oneup_live_..." # your Builder key
# python3 run.py "https://www.zillow.com/homedetails/..." # Python 3.8+
#
# ONEUP_BASE_URL changes the host (default https://api.oneupai.com). Every
# answer is printed as it arrives. Standard library only.
import json, os, sys, time, urllib.error, urllib.request, uuid
API = os.environ.get("ONEUP_BASE_URL", "https://api.oneupai.com")
KEY = os.environ["ONEUP_API_KEY"]
# The default Python User-Agent is refused before a request reaches the API;
# any name for your app works.
AGENT = "my-app/1.0"
if len(sys.argv) < 2:
raise SystemExit("Give the listing page address as the first argument")
LISTING = sys.argv[1]
def call(method, path, body=None, headers=None):
"""One API call: the answer is printed and returned; a refusal stops here."""
request = urllib.request.Request(
API + path,
method=method,
data=None if body is None else json.dumps(body).encode(),
headers={
"Authorization": f"Bearer {KEY}",
"Content-Type": "application/json",
"User-Agent": AGENT,
**(headers or {}),
},
)
try:
with urllib.request.urlopen(request, timeout=60) as response:
answer = json.load(response)
except urllib.error.HTTPError as error:
problem = json.load(error)
print(json.dumps(problem))
raise SystemExit(f"{error.code} {problem['error']}: {problem['message']}")
print(json.dumps(answer))
return answer
def retry_key():
return {"Idempotency-Key": str(uuid.uuid4())}
def wait_for(ticket):
"""Waits for a queued job (every 2 s for 30 s, then every 5 s); its result."""
started = time.monotonic()
status = call("GET", f"/v1/queue/status/{ticket}")
while status["status"] not in ("COMPLETED", "FAILED"):
time.sleep(2 if time.monotonic() - started < 30 else 5)
status = call("GET", f"/v1/queue/status/{ticket}")
return call("GET", f"/v1/queue/result/{ticket}")
def render(project_id, version_id, kind):
r = call(
"POST",
"/v1/renders",
{
"alias": "oneup/render-timeline",
"project_id": project_id,
"version_id": version_id,
"kind": kind,
},
retry_key(),
)
render_id = r["render_id"]
while r["status"] not in ("COMPLETED", "FAILED"):
time.sleep(5)
r = call("GET", f"/v1/renders/{render_id}")
return r
# 1. Read the listing (2 credits; the same retry key within 15 minutes
# returns the first answer without a charge).
listing = call(
"POST", "/v1/run/oneup/web-read-listing", {"url": LISTING}, retry_key()
)["output"]
facts = listing["facts"]
# 2. Bring the photos into your account (free; within an hour of the read).
imported = call(
"POST",
"/v1/uploads/from-extraction",
{
"extraction_id": listing["extraction_id"],
"urls": [p["url"] for p in listing["photos"][:40]],
},
)
# 3. Sharpen each photo whose shorter side is under 1080 pixels (2 credits
# each), and use the sharper copy in its place.
small = {
p["url"]
for p in listing["photos"]
if p.get("width", 1080) < 1080 or p.get("height", 1080) < 1080
}
photos = []
for item in imported["uploads"]:
if item["url"] not in small:
photos.append(item["upload_id"])
continue
job = call(
"POST",
"/v1/queue/submit/oneup/image-upscale",
{"image_url": item["file_url"]},
retry_key(),
)
sharper = wait_for(job["ticket"])
photos.append(sharper["assets"][0]["asset_id"])
if not photos:
raise SystemExit("no photo could be brought in")
# 4. The photo reel: each photo 3 s with a push-in or a pan, 0.4 s
# crossfades, a 4-second closing card, the address and price over the
# opening.
project = call("POST", "/v1/projects", {"agent_slug": "oneup/render-timeline"})
project_id = project["project_id"]
push_in = {
"op": "kenburns",
"from": {"x": 0.5, "y": 0.5, "zoom": 1},
"to": {"x": 0.5, "y": 0.5, "zoom": 1.18},
"ease": "ease_in_out",
}
pan = {
"op": "kenburns",
"from": {"x": 0.58, "y": 0.5, "zoom": 1.18},
"to": {"x": 0.42, "y": 0.5, "zoom": 1.18},
"ease": "ease_in_out",
}
segments = [
{
"id": f"p{i + 1}",
"source": {"$asset": photo},
"duration": 3000,
"effects": [push_in if i % 2 == 0 else pan],
"transition_out": {"op": "crossfade", "duration": 400},
}
for i, photo in enumerate(photos)
]
segments.append(
{
"id": "card",
"source": {"$asset": photos[-1]},
"duration": 4000,
"effects": [{"op": "fade", "from": 1, "to": 0, "duration": 600}],
}
)
timeline = {
"v": "1.1",
"output": {"aspect": "9:16", "resolution": 1080, "fps": 30, "container": "mp4"},
"segments": segments,
"overlays": [
{
"id": "t1",
"kind": "text",
"content": facts["address"],
"style": "lower_third",
"position": "middle",
"range": {"from": 0, "to": 3000},
"enter": {"op": "fade", "duration": 250},
"exit": {"op": "fade", "duration": 200},
},
{
"id": "t2",
"kind": "text",
"content": f"{facts['price']} · {facts['beds']} bd · {facts['baths']} ba",
"style": "lower_third",
"position": "bottom",
"range": {"from": 0, "to": 3000},
},
],
}
version = call("PUT", f"/v1/projects/{project_id}/timeline", {"timeline": timeline})
# 5. A free Preview, then the final, then the MP4's link (good for an hour).
render(project_id, version["version_id"], "preview")
final = render(project_id, version["version_id"], "final")
call("GET", f"/v1/queue/result/{final['ticket']}")