thorio / KGrabber

Userscript for extracting links from kissanime.ru and similar sites.
https://greasyfork.org/en/scripts/383649-kissgrabber
GNU General Public License v3.0
33 stars 12 forks source link

Downloading HydraX Streams #35

Open eslamsidereel opened 4 years ago

eslamsidereel commented 4 years ago

This script is amazing and after adding the idm export feature it became even more amazing. but since kissanime changed from rapidvideo to hydrax, i cant download any anime. I searched a lot but couldn't find a way to generate links from hydrax stream. It seems to be impossible so i had to use nova server and solve all the captcha to get the download links. If anybody knows a way to generate links from hydrax stream that would be a great help.

lavara123 commented 5 months ago

I found a solution on this specific site that uses Hydrax/Abyss.to Hope this helps!

Is it possible to do scraping?

lavara123 commented 5 months ago

@lavara123 Seems very possible to automate with little script. The waiting on globalcdn to appear might be sped up by expiring it faster or making it reconnect faster, somehow.

How to get here with just the embed url in scraping?

PatrickL546 commented 5 months ago

@lavara123 Haven't looked into automating or scraping with it so can't help ya

rosshauptnerin commented 5 months ago

The videocdn URL does not show up for me. Only wss://connect.idocdn.com:3010/ and wss://symphony-riding-higher-each.trycloudflare.com/

What am I doing wrong? I am using it for the same site as you btw (gojo2)

EDIT NVM. I got the URL to show now, but if I try to run the code I get

~~File "C:\Users\XXXX\PycharmProjects\XXXX.venv\Lib\site-packages\requests\sessions.py", line 794, in get_adapter raise InvalidSchema(f"No connection adapters were found for {url!r}") requests.exceptions.InvalidSchema: No connection adapters were found for 'wss://gpcsyjfe71.globalcdn93.one/e11443fc4ace6821b3'~~

EDIT2: NVM got it to work now. I had to replace wss with https. But still, is there a quicker and easier version to get the videocdn URL (wss://gpcsyjfe71.globalcdn93.one) other than disconnecting and reconnecting from the internet so I can see and copy it from the websocket tab?

PatrickL546 commented 5 months ago

New method only needs one link. More info https://github.com/PatrickL546/How-to-download-hydrax-abyss.to

pip install requests --upgrade

image

from base64 import b64decode
from requests import get
from json import loads
from re import search

print('cdn_ID. ie. "?v=VswFqVUmq" without "?v=". Note: ID should be 9 characters')
cdn_ID = input("Enter cdn_ID: ")

# leave empty for 360p
# add "www" for 720p
# add "whw" for 1080p
# if 1080p is not available, it will use the next highest quality
q_prefix = "whw"

domain, vid_id, sources = [loads(b64decode(search(r'PLAYER\(atob\("(.*?)"', get(f"https://abysscdn.com/?v={cdn_ID}").text).group(1)))[i] for i in ["domain","id","sources"]]

print(f"""
360p  =  " "  = "sd", "mHd"
720p  = "www" = "hd"
1080p = "whw" = "fullHd"

Available sources {sources}
Downloading "{q_prefix}" or next highest source available
Please wait...
""")

response = get(f"https://{domain}/{q_prefix}{vid_id}", headers={"Referer": f"https://abysscdn.com/?v={cdn_ID}"}, stream=True)
with open(f"{cdn_ID}.mp4", "wb") as f:
    for chunk in response.iter_content(chunk_size=8192):
        f.write(chunk)
kukhanh29 commented 5 months ago

How do I get it to show download information?

rosshauptnerin commented 5 months ago

Thank you so much for you work and all the help so far! I have another quick question, what would I have to add to the code so I can queue up multiple videos to download? I'd love to be able to just plug in multiple video IDs and then have it download them while I can do other things rather than having to start one download after the other. Or is that just not possible?

PatrickL546 commented 5 months ago

@rosshauptnerin . Quick and dirty script update

Check if download file already exists Multiple ID input, removes duplicate ID's from input Print errors, and some error handling

from base64 import b64decode
from os.path import isfile
from requests import get
from json import loads
from re import search

print(
    'cdn_ID. ie. "?v=VswFqVUmq" without "?v=". Note: ID should be 9 characters. Separate ID with comma ","'
)
cdn_ID_list = set([i.strip() for i in input("Enter cdn_ID: ").split(",")])

# leave empty for 360p
# add "www" for 720p
# add "whw" for 1080p
# if 1080p is not available, it will use the next highest quality
q_prefix = "whw"

error = []
for cdn_ID in cdn_ID_list:
    try:
        if isfile(f"./{cdn_ID}.mp4"):
            print(f"{cdn_ID}.mp4 already exists")
        else:
            domain, vid_id, sources = [
                loads(
                    b64decode(
                        search(
                            r'PLAYER\(atob\("(.*?)"',
                            get(f"https://abysscdn.com/?v={cdn_ID}").text,
                        ).group(1)
                    )
                )[i]
                for i in ["domain", "id", "sources"]
            ]

            print(f"""
360p  =  " "  = "sd", "mHd"
720p  = "www" = "hd"
1080p = "whw" = "fullHd"

Available sources {sources}
Downloading "{cdn_ID}.mp4" in quality "{q_prefix}" or next highest source available
Please wait...
""")

            response = get(
                f"https://{domain}/{q_prefix}{vid_id}",
                headers={"Referer": f"https://abysscdn.com/?v={cdn_ID}"},
                stream=True,
            )
            with open(f"{cdn_ID}.mp4", "wb") as f:
                for chunk in response.iter_content(chunk_size=8192):
                    f.write(chunk)
    except Exception:
        error.append(cdn_ID)

for i in error:
    print(f"Error downloading: {i}")
rosshauptnerin commented 5 months ago

@rosshauptnerin . Quick and dirty script update

Check if download file already exists Multiple ID input, removes duplicate ID's from input Print errors, and some error handling

from base64 import b64decode
from os.path import isfile
from requests import get
from json import loads
from re import search

print(
    'cdn_ID. ie. "?v=VswFqVUmq" without "?v=". Note: ID should be 9 characters. Separate ID with comma ","'
)
cdn_ID_list = set([i.strip() for i in input("Enter cdn_ID: ").split(",")])

# leave empty for 360p
# add "www" for 720p
# add "whw" for 1080p
# if 1080p is not available, it will use the next highest quality
q_prefix = "whw"

error = []
for cdn_ID in cdn_ID_list:
    try:
        if isfile(f"./{cdn_ID}.mp4"):
            print(f"{cdn_ID}.mp4 already exists")
        else:
            domain, vid_id, sources = [
                loads(
                    b64decode(
                        search(
                            r'PLAYER\(atob\("(.*?)"',
                            get(f"https://abysscdn.com/?v={cdn_ID}").text,
                        ).group(1)
                    )
                )[i]
                for i in ["domain", "id", "sources"]
            ]

            print(f"""
360p  =  " "  = "sd", "mHd"
720p  = "www" = "hd"
1080p = "whw" = "fullHd"

Available sources {sources}
Downloading "{cdn_ID}.mp4" in quality "{q_prefix}" or next highest source available
Please wait...
""")

            response = get(
                f"https://{domain}/{q_prefix}{vid_id}",
                headers={"Referer": f"https://abysscdn.com/?v={cdn_ID}"},
                stream=True,
            )
            with open(f"{cdn_ID}.mp4", "wb") as f:
                for chunk in response.iter_content(chunk_size=8192):
                    f.write(chunk)
    except Exception:
        error.append(cdn_ID)

for i in error:
    print(f"Error downloading: {i}")

That's perfect thank you!

PatrickL546 commented 3 months ago

I'm pretty happy with the current state of these

Hydrax-Abyss.to-DownloadHelper-Userscript

image

Hydrax-Abyss.to-DownloadHelper-Python

image

Just info How-to-download-hydrax-abyss.to