I need help with custom section on product page

Question:
Help with custom product page section

Product:
Wix Editor Dev Mode / Velo

What are you trying to achieve:
I want my custom section to expand only when there is content to display for that specific product, and to show the corresponding videos for that product. I have the data all connected properly as far as I can tell but it’s not working. This was based on a Youtube tutorial but I had to hand copy the code as the person’s site was down. Maybe I messed something up?

What have you already tried:
Everything I could think of

Additional information:
Here is the code:

import wixData from 'wix-data';
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';

$w.onReady(function () {

$w('#productPage1').getProduct()
    .then((product) => {
			let id = product._id;

	wixData.query("ExtraVideos")
		.eq("product", id)
		.find()
		.then((results) => {
			if (results.items.length > 0) {
		
				$w("#videoDataset").setFilter(wixData.filter()
						.eq("product", id)
					)
					.then(() => {
						console.log("Video Dataset is now filtered");
						$w('#videoStrip') .expand();
					})
					.catch((err) => {
						console.log(err);
					});
					} else {
						console.log("This item has no video files.");
						$w('#videoStrip'). collapse();
					}
		})
		.catch((error) => {
		let errorMsg = error.message;
		let code = error.code;
		});
})
.catch((error) => {
	console.error(error);
});

wixLocation.onChange((location) => {

	let newPath = location.path;
	$w('#productPage1').getProduct()
		.then((product) => {
			let id = product._id;

	wixData.query("ExtraVideos")
		.eq("product", id)
		.find()
		.then((results) => {
			if (results.items.length > 0) {
				$w("#videoDataset").setFilter(wixData.filter()
						.eq("product", id)
					)
					.then(() => {
						console.log("Video Dataset is now filtered");
						$w('#videoStrip') .expand();
					})
					.catch((err) => {
						console.log(err);
					});
					} else {
						console.log("This item has no video files.");
						$w('#videoStrip'). collapse();
					}
		})
		.catch((error) => {
		let errorMsg = error.message;
		let code = error.code;
		});
})
.catch((error) => {
	console.error(error);
});

Thanks for any help!

Based on the code you provided, it seems you forgot to close two of your methods:

Add a }); at the end of each method and your Page Code should run.