Giter Site home page Giter Site logo

Comments (1)

JustAnotherArchivist avatar JustAnotherArchivist commented on July 4, 2024

The current behaviour is expected and correct. Here's why:

Firstly, that URL is not a "directory" since it does not end with a slash. (I'm putting that in quotes since paths in URLs don't actually (need to) map to directories; it's just a similar hierarchical structure.) From wpull's perspective, that URL is for a single file.

Secondly, for single-file downloads, it's expected that this is stored in a file of the same name. For example, if you downloaded an audio file https://example.org/foo.ogg, you'd want foo.ogg, not foo.ogg/index.ogg or similar. It's impossible to reliably guess what structure you might desire, so storing it as a file with the same name is the only reasonable approach.

Thirdly, it's what wget does. Since wpull is intended to be a mostly drop-in replacement for wget, we can't really change that behaviour.


Now, here are a few ideas what you could do instead:

  1. Use --adjust-extension. This would produce refugee-camp-diary-31f2fe2942ef.html in the current directory, which might be closer to what you want.

  2. Specify the desired filename using --output-document. For example, wpull --output-document refugee-camp-diary-31f2fe2942ef/index.html https://medium.economist.com/refugee-camp-diary-31f2fe2942ef should do what you'd expect, but there seems to be a bug due to the redirects which I'll file separately (edit: filed as #453). It works with wget. Note that the directory already has to exist for this to work.

  3. For Medium specifically, you can add a slash at the end of the URL. This works because the server will redirect you back to the proper URL again. It would also work for servers which return the same content when that slash is added. But there are many cases where it won't work.
    What the extra slash does is make wpull think it's a "directory". Now, without any further options, this would just produce index.html in your current directory, but you can use --force-directories to make it create a directory structure even for this single file; then you'd get a file medium.economist.com/refugee-camp-diary-31f2fe2942ef/index.html. (If you use any sort of recursion option, e.g. --page-requisites, you can drop --force-directories.)

Hope this helps. I'll close this issue since there's nothing to do in terms of wpull development, but feel free to ask any further questions you have!

from wpull.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.