Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter orktree

    (@orktree)

    Thank you for the reply. I don’t know how but currently my above code works with ChatGPT’s help. And Apple has restored our podcast index and it works. I think I have fixed the special characters in the URL first then I have had the redirect issue. But thank you for your help, I will try your code next time I have similar issue.

    Thread Starter orktree

    (@orktree)

    It seems below filter works, it can pass https://www.castfeedvalidator.com/validate.php?url=https://cgcm.org/feed/podcast/ validation now. Not sure if it is the right solution tough.

    /**

    • ——————————————————————
    • Force SSP to use the real MP3 URL in
    • ——————————————————————
      *
    • ▸ Turns off the feed cache so you can see changes right away.
    • ▸ Disables every “passthrough / download-link” decision hook
    • SSP uses (episode level and series level).
    • ▸ Cleans text of control bytes forbidden in XML.
    • ▸ Finally, overwrites the enclosure URL with the _seriously_simple_episode_file
    • meta value just in case something else got there first.
      */

    /* 1 — never cache the feed while we’re testing ——————————–*/
    add_filter( ‘ssp_cache_feed’, ‘__return_false’ );

    /* 2 — global “don’t use the passthrough link” switches ————————*/
    add_filter( ‘ssp_use_download_link’, ‘__return_false’ );
    add_filter( ‘ssp_episode_passthrough_required’, ‘__return_false’, 10, 2 );
    add_filter( ‘ssp_series_passthrough_required’, ‘__return_false’, 10, 2 );

    /* 3 — last-chance rewrite of each item’s enclosure —————————*/
    add_filter( ‘ssp_feed_item_args’, function ( $args ) {

    /* 3a – scrub illegal control characters (safety net) */
    $bad_xml_bytes = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/u';
    array_walk_recursive( $args, function ( &$v ) use ( $bad_xml_bytes ) {
        if ( is_string( $v ) ) {
            $v = preg_replace( $bad_xml_bytes, '', $v );
        }
    } );
    
    /* 3b – make absolutely sure the enclosure URL is the raw MP3 */
    if ( ! empty( $args['post_id'] ) ) {
        $direct_mp3 = get_post_meta( $args['post_id'], '_seriously_simple_episode_file', true );
        if ( $direct_mp3 ) {
            $args['enclosure_url'] = $direct_mp3;   // for SSP 3.x
            $args['enclosure']     = $direct_mp3;   // for SSP 2.x fall-back
        }
    }
    
    return $args;

    } );

Viewing 2 replies - 1 through 2 (of 2 total)