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

new feature: download img from dropbox url #1

Open
shannon112 opened this issue May 11, 2023 · 13 comments
Open

new feature: download img from dropbox url #1

shannon112 opened this issue May 11, 2023 · 13 comments

Comments

@shannon112
Copy link
Owner

No description provided.

@shannon112
Copy link
Owner Author

shannon112 commented May 11, 2023

https://randomnerdtutorials.com/esp32-https-requests/
image
image

With the ESP32, to check the validity of a server, you can load any of those certificates: root, intermediate, or server certificate.

So, if you want to use it in your ESP32 projects, you’ll need to update your code quite frequently. If you want your code to run for years without worrying, you can use the website’s root certificate, which usually has a validity of five to ten years or more.

One of the easiest ways is to download the certificate directly from your browser. You can also use OpenSSL and get all the certificate information you need using the command line (we won’t cover this method in this tutorial).

@shannon112
Copy link
Owner Author

linux command to get my github profile photo
url -X GET "https://avatars.githubusercontent.com/u/24497728?v=4" --output img.png

@shannon112
Copy link
Owner Author

similar project: https://github.com/Jaycar-Electronics/Digital-Photo-Frame
including decoding from a imgur photo

@shannon112
Copy link
Owner Author

shannon112 commented May 14, 2023

how to get imgur images from album:
https://stackoverflow.com/questions/29354303/imgur-retrieval-of-direct-image-urls-given-album-link
curl -X GET "https://imgur.com/a/d0xpCRq/all" --output output.txt
https://github.com/nkouevda/albumr/blob/main/albumr/albumr.py

<div class="post-images">
<div id="zWhyREP" class="post-image-container" itemscope itemtype="https://schema.org/ImageObject">
<div id="VlVMfth" class="post-image-container post-image-container--spacer" itemscope itemtype="https://schema.org/ImageObject">
<script type="text/javascript">
            image               : {"id":"d0xpCRq","title":null,"description":null,"privacy":"1","cover":"VlVMfth","order":"0","layout":"b","num_images":"2","datetime":"2023-05-14 03:34:14","title_clean":null,"views":"1","isAd":false,"hash":"d0xpCRq","album_cover":"VlVMfth","album_privacy":"1","album_description":null,"album_layout":"b","starting_score":0,"is_album":true,"operation":null,"favorited":false,"force_grid":false,"is_viral":false,"cover_deletehash":"","album_images":{"count":2,"images":[{"hash":"VlVMfth","title":"","description":null,"has_sound":false,"width":907,"height":523,"size":263680,"ext":".png","animated":false,"prefer_video":false,"looping":false,"datetime":"2023-05-14 03:34:25","edited":"0"},{"hash":"zWhyREP","title":"","description":null,"has_sound":false,"width":836,"height":1169,"size":361123,"ext":".png","animated":false,"prefer_video":false,"looping":false,"datetime":"2023-05-14 03:39:48","edited":"0"}]},"adConfig":{"safeFlags":["not_in_gallery","share"],"highRiskFlags":[],"unsafeFlags":["sixth_mod_unsafe"],"wallUnsafeFlags":[],"showsAds":false,"showAdLevel":1,"safe_flags":["not_in_gallery","share"],"high_risk_flags":[],"unsafe_flags":["sixth_mod_unsafe"],"wall_unsafe_flags":[],"show_ads":false,"show_ad_level":1,"nsfw_score":0}},

@shannon112
Copy link
Owner Author

shannon112 commented May 14, 2023

found official api: https://apidocs.imgur.com/#7dde894b-a967-4419-9be2-082fbf379109

GET https://api.imgur.com/3/album/{{albumHash}}/images

@shannon112
Copy link
Owner Author

parse json

{
    "id": "d0xpCRq",
    "title": null,
    "description": null,
    "privacy": "1",
    "cover": "VlVMfth",
    "order": "0",
    "layout": "b",
    "num_images": "2",
    "datetime": "2023-05-14 03:34:14",
    "title_clean": null,
    "views": "1",
    "isAd": false,
    "hash": "d0xpCRq",
    "album_cover": "VlVMfth",
    "album_privacy": "1",
    "album_description": null,
    "album_layout": "b",
    "starting_score": 0,
    "is_album": true,
    "operation": null,
    "favorited": false,
    "force_grid": false,
    "is_viral": false,
    "cover_deletehash": "",
    "album_images": {
        "count": 2,
        "images": [
            {
                "hash": "VlVMfth",
                "title": "",
                "description": null,
                "has_sound": false,
                "width": 907,
                "height": 523,
                "size": 263680,
                "ext": ".png",
                "animated": false,
                "prefer_video": false,
                "looping": false,
                "datetime": "2023-05-14 03:34:25",
                "edited": "0"
            },
            {
                "hash": "zWhyREP",
                "title": "",
                "description": null,
                "has_sound": false,
                "width": 836,
                "height": 1169,
                "size": 361123,
                "ext": ".png",
                "animated": false,
                "prefer_video": false,
                "looping": false,
                "datetime": "2023-05-14 03:39:48",
                "edited": "0"
            }
        ]
    },
    "adConfig": {
        "safeFlags": [
            "not_in_gallery",
            "share",
            "page_load"
        ],
        "highRiskFlags": [],
        "unsafeFlags": [
            "sixth_mod_unsafe"
        ],
        "wallUnsafeFlags": [],
        "showsAds": false,
        "showAdLevel": 1,
        "safe_flags": [
            "not_in_gallery",
            "share",
            "page_load"
        ],
        "high_risk_flags": [],
        "unsafe_flags": [
            "sixth_mod_unsafe"
        ],
        "wall_unsafe_flags": [],
        "show_ads": false,
        "show_ad_level": 1,
        "nsfw_score": 0
    }
}

https://github.com/bblanchon/ArduinoJson
https://arduinojson.org/v6/example/parser/

@shannon112
Copy link
Owner Author

shannon112 commented May 14, 2023

https GET request cannot use HTTP/2.0, has to use HTTP/1.0, or will get bad request

@shannon112
Copy link
Owner Author

shannon112 commented May 14, 2023

cannot read all?

      //char c = client.read();
      //Serial.write(c);

using readString instead

      String response = client.readString(); 
      Serial.println(response);

https://github.com/espressif/arduino-esp32/blob/3ec5f4efa1de4342aaab742008dc630091e5e035/cores/esp32/Stream.h#L118

@shannon112
Copy link
Owner Author

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

No branches or pull requests

1 participant