faker-js / faker

Generate massive amounts of fake data in the browser and node.js
https://fakerjs.dev
Other
12.15k stars 883 forks source link

Faker Video Module #1568

Open SamratSahoo opened 1 year ago

SamratSahoo commented 1 year ago

Clear and concise description of the problem

As a developer, I generally have video data of some sort -- using faker for generating video data (i.e. a URL to a hosted video, similar to how y'all do images) would be useful for populating my database with test video data.

Suggested solution

My idea for this looked something like this:

faker.video.animal() // returns a URL to a video of an animal

Usage would be exactly the same as the image module but for videos. I know y'all use Loremflickr for images but I'm not too sure if a video alternative exists.

Alternative

Right now, I hardcode a single video to use throughout the app for testing -- it works fine, but more diverse video sets would be nicer.

Additional context

No response

fzn0x commented 1 year ago

I don't think this is going to be stable, video can be removed

ST-DDT commented 1 year ago
SamratSahoo commented 1 year ago
  • Do you know of a website that provides these?

    • Which video formats do you need?
  1. I do not know of a website that could do that
  2. MP4 would probably suffice since that generally tends to be the most common format
SalahAdDin commented 9 months ago

I don't think this is going to be stable, the video can be removed

there were any video modules? It could get random video URLs from youtube or any other service.

github-actions[bot] commented 9 months ago

Thank you for your feature proposal.

We marked it as "waiting for user interest" for now to gather some feedback from our community:

musjj commented 3 days ago

Does anyone have any alternatives for this? Are there are any services like https://loremflickr.com but for videos?

fzn0x commented 2 days ago

Hi @musjj @SalahAdDin just play around with the video IDs.

The amount intermittent issues that will be introduced is not worth, and images works fine with base64 or ipfs services, so this is unlikely to be feasible except Faker team want to upload those videos for us which I believe not.

Current workaround is to get available videos video ID and make your own utility for it.

function getRandomYouTubeVideoUrl() {
  const videos = [
    "dQw4w9WgXcQ", // Rick Astley - Never Gonna Give You Up
    "9bZkp7q19f0", // PSY - GANGNAM STYLE
    "3JZ_D3ELwOQ", // Maroon 5 - Sugar
    "e-ORhEE9VVg", // Ed Sheeran - Shape of You
    "RgKAFK5djSk", // Wiz Khalifa - See You Again ft. Charlie Puth
    "kXYiU_JCYtU", // Linkin Park - Numb
    "kJQP7kiw5Fk", // Luis Fonsi - Despacito ft. Daddy Yankee
    "fJ9rUzIMcZQ", // Queen - Bohemian Rhapsody
    "CevxZvSJLk8", // Katy Perry - Roar
    "60ItHLz5WEA", // Eminem - Without Me
  ];

  const randomIndex = Math.floor(Math.random() * videos.length);

  const randomVideoId = videos[randomIndex];
  return `https://www.youtube.com/watch?v=${randomVideoId}`;
}

const randomVideoUrl = getRandomYouTubeVideoUrl();
console.log(randomVideoUrl); 

If you want this video (please click), then just put the video id to the array.

And also use different services for videos to put in the array will decrease reliability, we will like to trust one service for the videos, in my head now is Youtube.

fzn0x commented 2 days ago

Use AI to generate those available video IDs, that is unbelievable works!

matthewmayer commented 2 days ago
function getRandomYouTubeVideoUrl() {
  const videos = [
    "dQw4w9WgXcQ", // Rick Astley - Never Gonna Give You Up
    "9bZkp7q19f0", // PSY - GANGNAM STYLE
    "3JZ_D3ELwOQ", // Maroon 5 - Sugar
    "e-ORhEE9VVg", // Ed Sheeran - Shape of You
    "RgKAFK5djSk", // Wiz Khalifa - See You Again ft. Charlie Puth
    "kXYiU_JCYtU", // Linkin Park - Numb
    "kJQP7kiw5Fk", // Luis Fonsi - Despacito ft. Daddy Yankee
    "fJ9rUzIMcZQ", // Queen - Bohemian Rhapsody
    "CevxZvSJLk8", // Katy Perry - Roar
    "60ItHLz5WEA", // Eminem - Without Me
  ];

  const randomVideoId = faker.helpers.arrayElement(videos);
  return `https://www.youtube.com/watch?v=${randomVideoId}`;
}

You can use the faker.helpers.arrayElement helper function so you can take advantage of fakers seeding logic etc for reproducible results.

SalahAdDin commented 2 days ago

Hi @musjj @SalahAdDin just play around with the video IDs.

The amount intermittent issues that will be introduced is not worth, and images works fine with base64 or ipfs services, so this is unlikely to be feasible except Faker team want to upload those videos for us which I believe not.

Current workaround is to get available videos video ID and make your own utility for it.

function getRandomYouTubeVideoUrl() {
  const videos = [
    "dQw4w9WgXcQ", // Rick Astley - Never Gonna Give You Up
    "9bZkp7q19f0", // PSY - GANGNAM STYLE
    "3JZ_D3ELwOQ", // Maroon 5 - Sugar
    "e-ORhEE9VVg", // Ed Sheeran - Shape of You
    "RgKAFK5djSk", // Wiz Khalifa - See You Again ft. Charlie Puth
    "kXYiU_JCYtU", // Linkin Park - Numb
    "kJQP7kiw5Fk", // Luis Fonsi - Despacito ft. Daddy Yankee
    "fJ9rUzIMcZQ", // Queen - Bohemian Rhapsody
    "CevxZvSJLk8", // Katy Perry - Roar
    "60ItHLz5WEA", // Eminem - Without Me
  ];

  const randomIndex = Math.floor(Math.random() * videos.length);

  const randomVideoId = videos[randomIndex];
  return `https://www.youtube.com/watch?v=${randomVideoId}`;
}

const randomVideoUrl = getRandomYouTubeVideoUrl();
console.log(randomVideoUrl); 

If you want this video (please click), then just put the video id to the array.

And also use different services for videos to put in the array will decrease reliability, we will like to trust one service for the videos, in my head now is Youtube.

Pretty nice idea!

musjj commented 2 days ago

Thanks, I also found this gist for those who need direct video URLs instead of YouTube links: https://gist.github.com/aguilarcarlos/6fdb4b417285666246171d6320f70fb6 Not a lot, but enough to get started.