VideoHelp Forum




+ Reply to Thread
Page 2 of 2
FirstFirst 1 2
Results 31 to 33 of 33
  1. oh great news. nice to know. and i don't think need to edit the script for some links only. the script still work fine
    Quote Quote  
  2. Code:
    import requests
    from bs4 import BeautifulSoup
    import re
    import subprocess
    import time
    import json  # Importation de la bibliothèque json
    
    # Fonction pour récupérer l'URL m3u8
    def get_ep(playerid, episodeId=None):
        headers = {
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
            'Referer': 'https://vixcloud.co'
        }
        if episodeId:
            params = {'episode_id': episodeId}
            response = requests.get(f'https://streamingcommunity.prof/iframe/{playerid}', headers=headers, params=params)
        else:
            response = requests.get(f'https://streamingcommunity.prof/iframe/{playerid}', headers=headers)
    
        soup = BeautifulSoup(response.text, 'html.parser')
        iframe_tag = soup.find('iframe', {'ref': 'iframe'})
        
        if iframe_tag:
            iframe_src = iframe_tag.get('src')
            response = requests.get(iframe_src, headers=headers)
    
            # Récupération des informations nécessaires (URL, token, expires)
            matches = {
                'url': r"url: '([^']+)'", 
                'token': r"'token': '([^']+)'", 
                'expires': r"'expires': '([^']+)'"
            }
            m = {}
            for match, regex in matches.items():
                mm = re.search(regex, response.text)
                if mm:
                    m[match] = mm.group(1)
                else:
                    print(f"{match} not found")
    
            if all(key in m for key in ['url', 'token', 'expires']):
                m3u8_url = f"{m['url']}?token={m['token']}&expires={m['expires']}&h=1"
                return m3u8_url
            else:
                print("Required keys are missing from the iframe response.")
                return None
        else:
            print("No iframe tag found")
            return None
    
    # Fonction pour récupérer les saisons et épisodes
    def get_season(page_url):
        headers = {
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
            'Referer': 'https://vixcloud.co'
        }
        
        response = requests.get(page_url, headers=headers)
        soup = BeautifulSoup(response.text, 'html.parser')
        
        app_div = soup.find('div', {'id': 'app'})
        if app_div and 'data-page' in app_div.attrs:
            data_page = app_div['data-page']
            data_page_json = json.loads(data_page)  # Utilisation de json.loads pour convertir en JSON
            title = data_page_json['props']['title']['name']
            playerid = data_page_json['props']['title']['id']
            type = data_page_json['props']['title']['type']
    
            if type == 'movie':
                name_base = sanitize_filename(title)
                m3u8_url = get_ep(playerid)
                download_video(m3u8_url, name_base)
            else:
                season = data_page_json['props']['loadedSeason']
                if season:
                    snumber = season['number']
                    for episode in season['episodes']:
                        enumber = episode['number']
                        name = episode['name']
                        episodeId = episode['id']
                        m3u8_url = get_ep(playerid, episodeId)
                        name_base = sanitize_filename(f"{title} S{str(snumber).zfill(2)}E{str(enumber).zfill(2)} {name}")
                        download_video(m3u8_url, name_base)
        else:
            print("No data-page attribute found in the div with id 'app'")
    
    # Fonction pour nettoyer les noms de fichiers
    def sanitize_filename(name):
        return re.sub(r'[\\/*?:"<>|]', "", name)
    
    # Fonction pour télécharger la vidéo avec N_m3u8DL-RE
    def download_video(url, output_name_base):
        output_file = f"{output_name_base}.mp4"
        
        command = [
            'N_m3u8DL-RE', 
            url,
            '--header', 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
            '--header', 'Referer: https://vixcloud.co',
            '--save-name', output_name_base,
            '-sv', 'best',
            '-sa', 'best',
            '-M' ,'format=mp4',
        ]
        
        try:
            subprocess.run(command, check=True)
            print(f"Téléchargement et muxage terminé pour : {output_file}")
        except FileNotFoundError:
            print("N_m3u8DL-RE n'est pas installé ou n'est pas dans le PATH.")
        except subprocess.CalledProcessError as e:
            print(f"Erreur lors du téléchargement : {e}")
    
    # Exemple d'URL à traiter
    urls = [
        "https://streamingcommunity.prof/titles/8424-dark-matter"
    ]
    
    for url in urls:
        get_season(url)
    This script works to download series.(...and some films)

    However, after several downloads, I have a 403 error.... I am trying to resolve it.
    Last edited by cedric8528; 1st Jan 2025 at 07:41.
    Quote Quote  
  3. Member
    Join Date
    Oct 2024
    Location
    Verona (Italy)
    Search Comp PM
    A quick update: the trick to replace the "?" with "&" before "token" does not work always.
    It worked for the test I did, it didn't with another stream.

    So don't consider it that much.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!