VeryEvilHumna / justfor.fans.ripper

Script to download all content from someone's JustFor.Fans. Fork of whats-happening-rightnow's repo, but working fork
Mozilla Public License 2.0
0 stars 3 forks source link

HLS.m3u8 Fix? #2

Open homicidalfantasies opened 1 year ago

homicidalfantasies commented 1 year ago

Hello, So I'm working on a solution for the playlist issue. I was planning on just using yt-dlp. I'm testing the cli right now and it has no issues downloading the videos. I can regex the URL to check for the hls.m3u8. Does that work? It would require yt-dlp and ffmpeg as a dependency though, but I think video downloading is a very high priority.

homicidalfantasies commented 1 year ago

from yt_dlp import YoutubeDL



`def video_save(vpost):
    vpost.ext = 'mp4'
    vpost.prepdata()

    folder = create_folder(vpost)
    vpath = os.path.join(folder, vpost.title)

    if not config.overwrite_existing and os.path.exists(vpath):
        print(f'v: <<exists skip>>: {vpath}')
        return

    # print(vpost.post_soup)
    try:
        vidurljumble = vpost.post_soup.select('div.videoBlock a')[0].attrs['onclick']
        vidurl = json.loads(vidurljumble.split(', ')[1])

        vpost.url_vid = vidurl.get('1080p', '')
        vpost.url_vid = vidurl.get('540p', '') if vpost.url_vid == '' else vpost.url_vid

        print(f'v: {vpath}')
        print(vpost.url_vid)

        isPlaylist = "hls.m3u8" in vpost.url_vid

        if isPlaylist:
            ydl_opts = {
                'outtmpl': vpath,
                'concurrent_fragment_downloads': 8,
            }
            YoutubeDL(ydl_opts).download(vpost.url_vid)
        else:
            response = requests.get(vpost.url_vid, stream=True)

            print("Downloading " + str(round(int(response.headers.get('content-length'))/1024/1024, 2)) + " MB")

            with open(vpath, 'wb') as out_file:
                shutil.copyfileobj(response.raw, out_file)
            del response

    except Exception as e:
        print(e)
`
homicidalfantasies commented 1 year ago

This appears to work okay. I'm still seeing an issue with resumes where it's not fully downloading the file. It's very slow as well.

homicidalfantasies commented 1 year ago

@VeryEvilHumna what do you think?

VeryEvilHumna commented 1 year ago

Sorry for ignoring this issue. Forgot to enable email notifications for all issues.

rn I have no valid userhashes, because I fixed this script for my friend (I think now he has enough porn to not pay for it anymore), I can't properly test your code.

Feel free to fork this repo and create a PR. I don't think that I will merge it until my friend buys another subscription to someone's JFF. But other people will see that HLS issue is no more a thing