4pr0n / ripme

Downloads albums in bulk
MIT License
917 stars 203 forks source link

Learning this as I go, looking for some advice on a code question. #349

Open Kimberlie03 opened 8 years ago

Kimberlie03 commented 8 years ago

Smutty seems to glance over MP4s due to the way its coded its video links, and I haven't been able to figure out a solution. However, using the mobile site does not generate this problem. The mobile site's html looks almost identical except that it doesn't load thumbnail versions of the images, but the fullsize. After adjusting the code to search for the mobile site, I can get it to scan the pages, but it's not turning up images. Forgive me, I've been learning this as I'm going, as I'm pretty stupid when it comes to coding. The non-mobile code where I think the problem is is as follows:

// Construct direct link to image based on thumbnail
StringBuilder sb = new StringBuilder();
String[] fields = imageUrl.split("/");
for (int i = 0; i < fields.length; i++) {
**if (i == fields.length - 2 && fields[i].equals("m")) {
fields[i] = "b";**
}
sb.append(fields[i]);
if (i < fields.length - 1) {
sb.append("/");
}
}
imageUrl = sb.toString();
addURLToDownload(new URL(imageUrl));
}
if (doc.select("#next").size() == 0) {
break; // No more pages
}
// Wait before loading next page

As I think I understand it, the bold portion is telling it to looking for the subdirectory "M" and change it to "B". "M" being the thumbnail version to the full version, "B". After adjusting the ripper to look for the mobile site, me changing the "M" to "B" (so B just changes to B) turns up no image results on any page it checks. So obviously I'm misunderstanding something here. Can anyone help?

ProperGeezer commented 8 years ago

If you've adjusted the code to use the mobile site, which loads the full images anyway, then you can delete this whole section entirely and it should work

// Construct direct link to image based on thumbnail
StringBuilder sb = new StringBuilder();
String[] fields = imageUrl.split("/");
for (int i = 0; i < fields.length; i++) {
    if (i == fields.length - 2 && fields[i].equals("m")) {
        fields[i] = "b";
    }
    sb.append(fields[i]);
    if (i < fields.length - 1) {
        sb.append("/");
    }
}
imageUrl = sb.toString();
metaprime commented 7 years ago

@Kimberlie03 were you able to figure things out? Need any help? Do you have a patch you'd like to submit to this project?