Comments (1)
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:
-
Use
--adjust-extension
. This would producerefugee-camp-diary-31f2fe2942ef.html
in the current directory, which might be closer to what you want. -
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. -
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 produceindex.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 filemedium.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)
- 'ValueError: write to closed file' when using --output-document with redirects HOT 1
- Providing an empty string to `--post-data` makes wpull send GET instead of POST requests
- ValueError: Field missing colon.
- Abort downloads when reaching the --monitor-disk limit
- Writing output to stdout (--output-document -) crashes with a TypeError
- LinkInfo/LinkContext's linked and inline fields for HTML-extracted URLs are not always bools
- NUL byte in <link> href confuses libxml2-lxml parser
- HTML in JavaScript leads to undecoded character references in URLs
- resolve_dns hook lacks information on IPv4/IPv6 preference and can't return more than one result
- OSError when the cookie jar gets cleared
- SQLAlchemy 1.4 incompatibility: `sqlalchemy.orm.evaluator.UnevaluatableError: Cannot evaluate Select`
- FTP login information in URLs is lost
- Handle `Refresh` header as a redirect
- Support for server-side image maps
- Migrate test suite to Drone HOT 1
- Always send the `Host` header first HOT 1
- Equivalent but differently encoded URLs break no-parent recursion
- FTP processor may start retrieval before logging the `Fetching` message
- AttributeError: module 'collections' has no attribute 'Mapping' HOT 6
- ValueError: IPv6 addresses are 16 bytes long HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wpull.