Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request/Contribution] Have working Bash code written for Eka's Portal/Aryion/G4 galleries -- request inclusion of equivalent functionality in gallery-dl #673

Closed
ancientmistakes opened this issue Apr 5, 2020 · 4 comments

Comments

@ancientmistakes
Copy link

ancientmistakes commented Apr 5, 2020

I have working Bash code for downloading of both individual galleries and multiple galleries from Eka's Portal, which is a unique and old gallery dedicated to specific kinks and, as such, it is worthy of cultural preservation. So, the request is that the code be translated to a format suited for gallery-dl and then included in gallery-dl. The code and its usage are detailed as follows:

download_g4_gallery(){
    username="${1}"
    echo "counting number of pages of updates..."
    pages=$(curl -s "https://aryion.com/g4/latest/"${username}"" | grep -Eo "page 1 of [[:digit:]]*" | head -n1 | awk 'NF>1{print $NF}')
    echo "pages: "${pages}""
    echo "getting list of IDs from "${pages}" pages..."
    list="$(curl -s "https://aryion.com/g4/latest/"${username}"&p=[1-2]" | grep view/ | sed -n 's/.*href="\([^"]*\).*/\1/p' | grep -o '[^/]*$' | awk '{ print "https://aryion.com/g4/data.php?id=" $0; }' | tr '\n' ' ')"
    # The curl options `--time-cond` and `--output` ensure that only files that have not been downloaded previously are downloaded.
    curl --time-cond --output --remote-name-all --fail --remote-time --remote-header-name ${list}
}

This is used in the following manner, with the username specified instead of a full URL:

download_g4_gallery username

To download multiple galleries, a file that lists the various usernames, for example watching.md, can be created and provided to a looping function that uses the above function:

download_g4_galleries(){
    #filename="${1}"
    filename="watching.md"
    while read username; do
        echo "${username}"
        mkdir "${username}"
        cd "${username}"
        download_g4_gallery "${username}"
        cd ..
    done <"${filename}"
}

This is then used at the working directory at which is the watching.md file:

download_g4_galleries
@kattjevfel
Copy link
Contributor

Yo this looks way better than my own script, will give this a go. Anyway why not post this to the original issue? #390

@ancientmistakes
Copy link
Author

Felis @kattus, I note that my code is indeed very similar to your own. ;) Do you know of some guidance to get this Bash scripting consumed into the codebase of gallery-dl?

Actually, aside from the appeal, I do think that it's pretty important that cultural kinks like those stored on Eka's are backed-up in a decentralised way. Including the functionality to do so in gallery-dl is one way of helping that happen.

@kattjevfel
Copy link
Contributor

Unfortunately I don't know much about getting it be integrated into gallery-dl, aside, I doubt mikf would be a fan of jamming a shell script in there. Sadly I don't know any python (nor do I have the motivation to get on with that) to make it in python.

@mikf
Copy link
Owner

mikf commented Apr 8, 2020

Closing this in favor of the original: #390

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants