Below is a step by step way to find sellers who have stolen your video and re-uploaded it as their own.

Step 1 – Show All Your Videos

On your storefront, click the filter button at the top of your video page that says videos. We only want to see videos on the page. Then, scroll to the bottom of the page until all of your videos have been shown. Because Amazon does a lazy load, you’ll have to keep scrolling and scrolling and scrolling to get more videos to appear until you reach the end of the list.

Step 2 – Copy This Code

(async function() {
    // Function to remove emojis from a string
    function removeEmojis(str) {
        return str.replace(/[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{1F700}-\u{1F77F}\u{1F780}-\u{1F7FF}\u{1F800}-\u{1F8FF}\u{1F900}-\u{1F9FF}\u{1FA00}-\u{1FA6F}\u{2600}-\u{26FF}\u{2700}-\u{27BF}]+/gu, '');
    }

    // User-defined shop name (without needing to worry about emojis)
    let userShopName = "PASTE YOUR STOREFRONT NAME HERE";  // Example, replace this with user input

    // Remove emojis from the user's shop name for comparison
    userShopName = removeEmojis(userShopName).trim();

    // Function to extract ASINs from the current page
    function getASINs() {
        const asinElements = document.querySelectorAll('.video-item-wrapper');
        const asins = [];
        asinElements.forEach(el => {
            const asin = el.querySelector('span[data-video-item-click]').getAttribute('data-video-item-click');
            const asinData = JSON.parse(asin);
            
            // Extract related products
            const relatedProducts = asinData.lightboxParams.relatedProducts;
            if (relatedProducts) {
                const relatedProductList = relatedProducts.split(','); // Split the comma-separated string into an array
                asins.push(...relatedProductList);  // Flatten the array
            }
        });
        return asins;
    }

    // Function to fetch video information
    const fetchVideoInfo = async (asin) => {
        const marketplaceID = 'ATVPDKIKX0DER';

        const fetchFromAPI = async (marketplaceID, asin, placement) => {
            const requestBody = {
                pageContext: {
                    page: "DetailPage",
                    placement: placement,
                    device: "Desktop",
                    marketplaceID: marketplaceID,
                    locale: "en_US",
                    product: {
                        contentID: asin,
                        contentIDType: "ASIN"
                    }
                },
                configuration: {
                    id: "div-relatedvideos",
                    type: "relatedvideos",
                    binder: "relatedvideos",
                    loader: "lazyload",
                    features: {
                        features: {
                            verticalcarousel: "true",
                            segmentOneHeaderId: "vse_ib_segment_one",
                            segmentTwoHeaderId: "vse_ib_segment_two",
                            segmentThreeHeaderId: "vse_ib_segment_three",
                            segmentOneHeaderDefault: "Videos for this product",
                            segmentTwoHeaderDefault: "Related videos",
                            segmentThreeHeaderDefault: "Customer review videos",
                            includeProfiles: "true",
                            showCustomerReviewMetadata: "true",
                            enableCustomerReviewVideos: "true"
                        }
                    },
                    sources: {
                        source: "VideoAdsDataAggregatorService"
                    }
                }
            };

            const response = await fetch("https://www.amazon.com/vap/ew/subcomponent/relatedvideos", {
                headers: {
                    'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36',
                    accept: "text/html,*/*",
                    "accept-language": "en-US,en;q=0.9",
                    "content-type": "application/json"
                },
                body: JSON.stringify(requestBody),
                method: "POST",
                mode: "cors",
                credentials: "include"
            });

            if (!response.ok) {
                console.error(`Failed to fetch API for ASIN: ${asin}, Status: ${response.status}`);
                return null;
            }

            const text = await response.text();
            return new DOMParser().parseFromString(text, "text/html");
        };

        const extractData = (video) => {
            const title = video.getAttribute('data-title') || 'N/A';
            const creatorType = video.getAttribute('data-creator-type') || 'N/A';
            const shopName = removeEmojis(video.getAttribute('data-vendor-name') || 'N/A').trim();  // Remove emojis for comparison
            const duration = video.getAttribute('data-duration') || 'N/A';  // Extract duration if available
            return { title, shopName, creatorType, duration };
        };

        // Selector to capture all videos in the carousel
        const upperCarouselSelector = '[data-aci-content-id]';
        const html = await fetchFromAPI(marketplaceID, asin, "ImageBlock");
        if (!html) {
            return [];
        }

        const upperCarouselVideos = Array.from(html.querySelectorAll(upperCarouselSelector)).map(video => extractData(video));

        return upperCarouselVideos;
    };

    // Function to convert duration string (e.g., "1:39") into total seconds
    function convertDurationToSeconds(duration) {
        const [minutes, seconds] = duration.split(':').map(Number);
        return minutes * 60 + seconds;
    }

    // Function to log video information for all related products (ASINs) and check durations
    async function logAndCheckVideos() {
        console.log('Starting to log video information and check brand video durations');
        let matchedASINs = new Set();  // To store ASINs with matching brand and influencer video durations

        const currentASINs = getASINs();  // Extract ASINs

        for (const productASIN of currentASINs) {
            console.log(`Processing ASIN: ${productASIN}`);
            const videoInfo = await fetchVideoInfo(productASIN);  // Fetch video info for each ASIN

            if (videoInfo && videoInfo.length > 0) {
                const myVideos = [];
                const brandVideos = [];

                // Separate influencer videos from brand videos
                videoInfo.forEach((video, index) => {
                    const durationInSeconds = convertDurationToSeconds(video.duration);
                    if (video.creatorType === 'Influencer' && video.shopName === userShopName) {
                        myVideos.push(durationInSeconds);  // Store influencer videos with user's shop name
                    } else if (video.creatorType === 'N/A') {
                        brandVideos.push({ durationInSeconds, title: video.title });  // Store brand videos
                    }
                });

                // Check if any brand video duration is within 5% over and 10% under any of the user's videos
                brandVideos.forEach(brandVideo => {
                    const { durationInSeconds } = brandVideo;
                    for (const myVideoDuration of myVideos) {
                        const lowerBound = myVideoDuration * 0.9;  // 10% under
                        const upperBound = myVideoDuration * 1.05;  // 5% over
                        if (durationInSeconds >= lowerBound && durationInSeconds <= upperBound) {
                            matchedASINs.add(productASIN);  // Add ASIN to matched set if condition is met
                        }
                    }
                });
            } else {
                console.log(`No upper carousel videos found for ASIN ${productASIN}.`);
            }
        }

        // Final output of matched ASINs
        if (matchedASINs.size > 0) {
            console.log(`Matched ASINs with similar brand and influencer video durations: ${Array.from(matchedASINs).join(', ')}`);
        } else {
            console.log("No ASINs found with matching video durations.");
        }
    }

    // Start the process of logging all related products and checking video durations
    await logAndCheckVideos();
})();

Please note that you will need to paste your storefront name into the code where it says PASTE YOUR STOREFRONT NAME HERE.

Step 3 – Open Your Chrome Terminal

In Chrome, on your Storefront page, right-click anywhere on the page and scroll to inspect. Once you are in inspect, at the top of the new window, click the tab that says console.

Step 4 – Paste Your Code

Paste your code in the Console window and hit Enter.

The code will iterate over each video on your page and record the video durations for each product for your and brand videos for comparison purposes.

Once the code is done and has iterated over each video, it will give a final output of all the product IDs that match the criteria and should be investigated for potential theft.

That’s all!

How the Code Works

we are searching for potential video theft by comparing video durations. The code will take the durations of any videos that we have made, even if a product has more than one video from us, and cross-referenced those video durations with the video durations that the brand has for their videos.

Suppose the brand has a video within 5% above our duration or 10% below our duration for our videos. In that case, this video will get put in the final output so we can verify if the video was stolen.

What the Code CANNOT Do

This code cannot find instances of theft where the video duration has been altered beyond our criteria. If you made a two-minute video, but the seller chopped it up and made a 30-second video, that will not appear in our output. We are only looking for videos that match our criteria percentage of duration.

Note

Don’t forget to read my article on How to File a Copyright Claim when you find a stolen video.

Similar Posts