Code Monkey home page Code Monkey logo

wallpaper-dl's Introduction

wallpaper-dl

Stars Downloads Version License

Wallpaper downloader for various websites

Supported Websites

Note: Alphacoder's Abyss websites tend to block the downloader, so it does not work all the time.

Usage

Downloading wallpapers:

wallpaper-dl <URLs>

Contributing

Want to add a feature, enhance website support or report a bug? Just open a new issue on GitHub!

wallpaper-dl's People

Contributors

stridsvagn69420 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

pocketappz

wallpaper-dl's Issues

Probably just make this a standalone downloader

I honestly think it's better to just make it a standalone downloader and remove all of the manager aspects. Sure, they're nice, but how often do you change wallpapers that you need a manager built-in? Even for rotating wallpapers, it's better to stick to Unix philosophy and have a separate wallpaper setter. I might actually make one, either in Rust or Zig.

[Feature] Allow custom User-Agents to bypass automation restrictions

The Problem

Out of all websites as of time of writing only the Alphacoders websites block the downloader almost every time. I know that the User-Agent is often the giving factor. The reason why it sets a User-Agent here is because some websites (e.g. Wallhaven) outright refuse to connect/respond normally with agent-less clients.

Experimenting

When trying to download an image from Wallaper Abyss, I get this error message:

wallpaper-dl https://wall.alphacoders.com/big.php?i=1362746

  Fetching https://wall.alphacoders.com/big.php?i=1362746 FAILED HTTP status client error (403 Forbidden) for url (https://wall.alphacoders.com/big.php?i=1362746)

Looking at the response using cURL, there is obviously a block from Cloudflare's side:

curl --head https://wall.alphacoders.com/big.php?i=1362746 -A "wallpaper-dl/0.2.0"

Date: Mon, 17 Jun 2024 20:55:45 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Set-Cookie: [REDACTED]
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Referrer-Policy: no-referrer-when-downgrade
X-Frame-Options: SAMEORIGIN
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Content-Type-Options: nosniff
CF-Cache-Status: DYNAMIC
Set-Cookie: [REDACTED]
Server: cloudflare
CF-RAY: [REDACTED]
alt-svc: h3=":443"; ma=86400

It also does not matter here if the user agent is set to wallpaper-dl's or none at all, since it's not from a normal browser. But watch what happens when I give it my browser's user agent:

 curl --head https://wall.alphacoders.com/big.php?i=1362746 -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"

HTTP/1.1 200 OK
Date: Mon, 17 Jun 2024 20:59:23 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Set-Cookie: [REDACTED]
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Referrer-Policy: no-referrer-when-downgrade
X-Frame-Options: SAMEORIGIN
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Content-Type-Options: nosniff
CF-Cache-Status: DYNAMIC
Set-Cookie: [REDACTED]
Server: cloudflare
CF-RAY: [REDACTED]
alt-svc: h3=":443"; ma=86400

The solution

I think the config just needs a little field where we can put a custom User-Agent to bypass this anti-bot detection. Does not work all the time apparently, but it might be useful even as a temporary fix for someone.

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.