• 54 Posts
  • 264 Comments
Joined 1 year ago
cake
Cake day: June 24th, 2023

help-circle







  • Other answer seems to suggest that the problem is that the same podcast can be available, depending on where and who is listening to it, with different length due to different ads injected into. Here’s my probably stupid and completely ignorant suggestion: instead of using timestamps for both begin and end of the ads segment, you could use a timestamp for the beginning, and an hash of the first part of “non-ads” segment. I’ll try to explain better:

    |----------------xxxxx--------------------|
                    ^     |___|
    

    The xxx is the ads segment, the ^ is the timestamp of the beginning of the ads, the |___| is a small duration segment (for example, 0.5 seconds) right after the ads segment. The data of that segment is hashed and used as “end ads segment indicator”.

    On the other device, with a different duration of the ads, you should start hashing it to find the corresponding segment.

    Is this doable or did I just said a bunch of idiot things?













  • hi, sorry for the late reply! I finally wrote this nodejs script:

    const puppeteer = require('puppeteer');
    
    // This is where we'll put the code to get around the tests.
    
    
    
    function findPlaylistUrl(networkUrls) {
      for (const url of networkUrls) {
        if (url.startsWith('https://vixcloud.co/playlist')) {
          return url;
        }
      }
      return ''; // Return an empty string if no matching URL is found
    }
    
    (async () => {
      // Check if URL argument is provided
      if (process.argv.length <= 2) {
        console.error('Usage: node get_network_urls.js <URL>');
        process.exit(1);
      }
    
      const url = process.argv[2];
    
      // Launch a headless browser
      const browser = await puppeteer.launch({ headless: 'true' });
      const page = await browser.newPage();
    
      // Enable request interception
      await page.setRequestInterception(true);
    
      // Capture network requests
      const networkUrls = [];
      page.on('request', (request) => {
        networkUrls.push(request.url());
        request.continue();
      });
    
      // Navigate to the URL
      await page.goto(url);
    
      // Wait for a while to capture network requests (adjust as needed)
      await page.waitForTimeout(5000);
    
      // Print the captured network URLs
      console.log(findPlaylistUrl(networkUrls));
        
      // Close the browser
      await browser.close();
    })();
    

    the first argument passed to the script is the url of the webpage. The script uses the puppeteer module to “fake” a browser, in order to receive all the network calls and so on, and then will search through them for the m3u8 playlist. It is very specific and only works on this website, but it can be easily adapted for other websites as well