tinami: get the full image.

Support grabbing the full image for Tinami uploads, rather than the sample.

Getting the full image requires making a request like this:

    curl -X POST \
    -H 'Referer: https://www.tinami.com/' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cookie: Tinami2SESSID=<redacted>;' \
    --data-raw 'action_view_original=true&cont_id=1087268&ethna_csrf=<redacted>' \
    https://www.tinami.com/view/1087268

Then scraping the <img> tag from the resulting HTML page.

If the post has multiple images, then we need to scrape and pass the
`sub_id` of the image too.

Fixes #2818.
This commit is contained in:
evazion
2022-03-19 23:22:09 -05:00
parent 0ddc09f011
commit 7f58cfbe5e
4 changed files with 62 additions and 17 deletions

View File

@@ -305,6 +305,11 @@ module Danbooru
nil
end
# Your Tinami "Tinami2SESSID" cookie. Login to Tinami then use the devtools to find the "Tinami2SESSID" cookie.
def tinami_session_id
nil
end
# 1. Register app at https://www.tumblr.com/oauth/register.
# 2. Copy "OAuth Consumer Key" from https://www.tumblr.com/oauth/apps.
def tumblr_consumer_key