Introduction

apiJAV is a WordPress system that lets you host videos on one WordPress site and import and display them on another โ€” automatically, with full metadata, taxonomy support, and permanent embed URLs.

๐Ÿ“ฅ

Client Plugin

My Video Public API โ€” connects to a server, lets you browse, import, and manage videos locally.

โšก

Bulk Import

Import thousands of videos by page range in one click. Duplicate detection is automatic.

๐Ÿ”’

Permanent Tokens

Embed URLs are generated with permanent tokens โ€” safe to store in your database forever.

How It Works

The system works as a source-destination pair. Your server site holds the original video posts. Your client site pulls them via REST API and creates local WordPress posts with all metadata preserved.

FLOW
Server Site (My Video API Manager)
  โ””โ”€ Hosts original video posts
  โ””โ”€ Exposes REST API at /wp-json/myvideo/v1/
  โ””โ”€ Generates permanent embed tokens

  โ†• REST API calls over HTTPS

Client Site (My Video Public API)
  โ””โ”€ Browses server via admin panel
  โ””โ”€ Imports posts with full meta + taxonomies
  โ””โ”€ Stores embed URL permanently in post meta
  โ””โ”€ Theme renders iframe from stored meta

Features

  • Browse & Search โ€” filter by category, tag, actor, studio, date, views
  • Bulk Import โ€” import by page range (e.g. page 26 โ†’ 1), 1000 videos per page
  • Import All โ€” one-click import of all available videos
  • Duplicate Detection โ€” single SQL batch query checks thousands of IDs instantly
  • Live Progress โ€” real-time progress bar, per-row status, pause/resume/cancel
  • Auto Page Switch โ€” table view automatically follows the currently importing page
  • Cache Control โ€” configurable transient cache + one-click clear
  • Taxonomy Sync โ€” categories, tags, actors, studios all created locally on import

Client Plugin โ€” Installation

Install My Video Public API on the WordPress site where you want to import and display the videos.

1

Upload & Activate

Go to Plugins โ†’ Add New โ†’ Upload Plugin. Upload my-video-public-api.zip and activate.

2

Enter API URL

Go to Video API โ†’ Settings and enter your server site's URL (e.g. https://your-server.com). Click Save, then Test Connection.

3

Start Browsing

Go to Video API โ†’ Browse Videos. Your server's videos will load automatically.

4

Bulk Import

Go to Video API โ†’ Bulk Import. Choose a filter, set your page range, and click Import All Pages.

Connecting to the Server

In Video API โ†’ Settings, enter the full URL of your server site โ€” no trailing slash, no /wp-json path. The plugin appends the REST API path automatically.

Example URLs
โœ… Correct:
https://myserver.com
https://videos.example.com

โŒ Wrong:
https://myserver.com/          # trailing slash
https://myserver.com/wp-json   # don't add the path
SettingDescription
api_urlServer site URL. Required.
per_pageDefault posts per page for Browse Videos. Max 100.
cache_minutesHow long to cache API responses. 0 = no cache.

Browse Videos

The Browse Videos page lets you search and filter the server's videos and import them one at a time.

  • Search โ€” filter by keyword, category, tag, actor, studio
  • Import button โ€” each card has an โฌ‡ Import button. Already-imported videos show a green โœ… Imported overlay
  • Batch check โ€” imported status is checked in a single database query per page load, not per video
  • Preview โ€” click โ–ถ Preview to open the player modal before importing
โ„น๏ธ
Page 1 = Newest videos โ€” The API orders by date descending by default. Page 1 has the most recently published videos; the last page has the oldest.

Bulk Import

The Bulk Import page lets you import thousands of videos with a single click. It runs sequentially โ€” one video at a time โ€” to avoid server overload.

Step 1 โ€” Choose Filter

Select a category, tag, and/or studio to narrow the import, or leave all blank to import everything. Set videos per page (up to 1000 if your server supports it).

Click Load Video Info to see the total video count and page count. This automatically clears any stale cache so you always get accurate numbers.

Step 2 โ€” Set Page Range

Set From Page and To Page. The import always runs from the highest page number down to the lowest โ€” meaning oldest-first, newest-last.

Or click โšก Import All Pages to queue every page automatically.

โš ๏ธ
Last page has fewer videos โ€” This is normal. If you have 25,631 videos at 1000/page, the last page (page 26) will have 631 videos. Import will handle it correctly and move on.

Step 3 โ€” Start Import

Click โ–ถ Start Import. The system will:

  1. Load all pages in the queue sequentially
  2. Check which videos are already imported (batch SQL query)
  3. Build a flat queue of only new videos
  4. Import them one by one with 150ms between each
  5. Auto-update the table view as each page completes

Import Speed

DelayWhenAdjustable?
150msBetween each successful importYes โ€” edit page-bulk-import.php
500msAfter a failed import (retry buffer)Yes
โฑ๏ธ
Estimated time: At 150ms delay + ~1โ€“3s per import (API fetch + DB write), expect 1โ€“3 minutes per 100 videos. A full 25,000-video import may take several hours โ€” use Pause/Resume freely.

Import by ID

Go to Video API โ†’ Import by ID to import a single video by its remote post ID. You can preview the player before importing.

Example
Remote Post ID: 12345
โ†’ Fetches from: https://server.com/wp-json/myvideo/v1/posts/12345
โ†’ Creates local post with all meta + embed URL

Imported Posts

The Imported Posts page shows all locally imported videos. From here you can:

  • Edit โ€” open the WordPress post editor
  • Play โ€” open the embed URL in a new tab
  • Refresh All Embeds โ€” re-fetches embed URLs from the server (only needed if server secret keys changed)

Meta Fields

Each imported post gets these WordPress post meta fields, which your theme can read:

Meta KeyContent
embedFull iframe HTML โ€” your ACF textarea field. Ready to output.
embed_urlPlain embed URL without iframe wrapper.
thumbThumbnail image URL.
post_views_countView count from the source server.
likes_countLike count from the source server.
dislikes_countDislike count.
hd_video'on' if HD, empty string if not.
codeVideo code/ID from the server.
duration_hhDuration hours component.
duration_mmDuration minutes component.
duration_ssDuration seconds component.
video_duration_combinedFull duration string, e.g. 01:23:45.
_mvapic_remote_idRemote post ID โ€” used for duplicate detection.

Example Theme Usage

PHP
// Output the embed in your single.php or template
$embed = get_post_meta( get_the_ID(), 'embed', true );
if ( $embed ) {
    echo $embed; // outputs the full <iframe> tag
}

// Or get the plain URL
$url = get_post_meta( get_the_ID(), 'embed_url', true );
$thumb = get_post_meta( get_the_ID(), 'thumb', true );
$views = get_post_meta( get_the_ID(), 'post_views_count', true );

Caching

API responses are cached using WordPress transients. The cache duration is set in Video API โ†’ Settings.

  • Browse Videos โ€” cached per unique filter combination
  • Bulk Import โ€” always fetches fresh (cache bypassed)
  • Embed URLs / Player โ€” never cached, always fresh
  • Filter options โ€” cached 6 hours

To clear all cached data, go to Video API โ†’ Settings โ†’ Clear Cache. The Bulk Import "Load Video Info" button also clears the posts cache automatically before fetching.

Taxonomies

On import, the plugin maps server taxonomies to local WordPress taxonomies:

Server FieldLocal TaxonomyNotes
categoriescategory (built-in)Created if not exists
tagspost_tag (built-in)Created if not exists
actorsactors (custom)Must be registered by your theme
studiostudio (custom)Must be registered by your theme
โš ๏ธ
Custom taxonomies โ€” actors and studio must be registered by your theme or a plugin before import. If they don't exist, those terms are silently skipped.

FAQ

Why does the page count change after I change per_page?

The total page count is calculated as ceil(total_videos / per_page). With 25,631 videos at 1000/page you get 26 pages. At 100/page you get 257 pages. Always click Load Video Info after changing the per-page setting to get the updated count โ€” the button also clears stale cache automatically.

Can I run multiple bulk imports at the same time?

It's not recommended. Two parallel imports on the same site may cause duplicate detection to miss posts that are mid-import. Run one at a time.

What happens if an import fails midway?

Already-imported videos are safe โ€” they're in your database. The failed item shows a red โŒ Error badge. You can click Resume or re-run the same range โ€” all previously imported videos will be detected and skipped.

Are embed URLs permanent?

Yes. The server generates embed tokens that never expire. They are safe to store in your WordPress database permanently. The only reason to use Refresh Embeds is if the server's WordPress secret keys were regenerated.

My categories/tags dropdown is empty

Go to Video API โ†’ Settings โ†’ Clear Cache and then reload the Bulk Import page. The filter dropdowns sample up to 1,000 posts from the API โ€” if your server is new and has few posts, the lists may be sparse.