mikf / gallery-dl

Command-line program to download image galleries and collections from several image hosting sites
GNU General Public License v2.0
11.19k stars 913 forks source link

Pin.it shorturl when tried only outputs the first url after redirect. #5864

Closed abhranil26 closed 1 month ago

abhranil26 commented 1 month ago

just running

gallery-dl "https://pin.it/39YYRhN0f" -v

this is the verbose output

[gallery-dl][debug] Version 1.27.1 - Git HEAD: 43eaeca50f
[gallery-dl][debug] Python 3.11.9 - macOS-14.5-arm64-arm-64bit
[gallery-dl][debug] requests 2.31.0 - urllib3 2.1.0
[gallery-dl][debug] Configuration Files []
[gallery-dl][debug] Starting DownloadJob for 'https://pin.it/39YYRhN0f'
[pinterest][debug] Using PinterestPinitExtractor for 'https://pin.it/39YYRhN0f'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): api.pinterest.com:443
[urllib3.connectionpool][debug] https://api.pinterest.com:443 "HEAD /url_shortener/39YYRhN0f/redirect/ HTTP/1.1" 302 0
[pinterest][debug] Using PinterestPinExtractor for 'https://www.pinterest.com/pin/266556871689003952/sent/?invite_code=80139d28e8a34cb38c105de2e84ac671&sender=762164074346835038&sfo=1'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): www.pinterest.com:443
[urllib3.connectionpool][debug] https://www.pinterest.com:443 "GET /resource/PinResource/get/?data=%7B%22options%22%3A+%7B%22id%22%3A+%22266556871689003952%22%2C+%22field_set_key%22%3A+%22detailed%22%7D%7D&source_url= HTTP/1.1" 200 4453
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): i.pinimg.com:443
[urllib3.connectionpool][debug] https://i.pinimg.com:443 "GET /originals/a5/6e/12/a56e122ccbc44204a9ecf2c0a9c6f303.jpg HTTP/1.1" 200 94097
./gallery-dl/pinterest/pinterest_266556871689003952.jpg

works normally, follows redirect and downloads the file, but i try with -g or -j, the output only contains the first url it is being redirected to.

gallery-dl "https://pin.it/39YYRhN0f" -v -g

this is the verbose output

[gallery-dl][debug] Version 1.27.1 - Git HEAD: 43eaeca50f
[gallery-dl][debug] Python 3.11.9 - macOS-14.5-arm64-arm-64bit
[gallery-dl][debug] requests 2.31.0 - urllib3 2.1.0
[gallery-dl][debug] Configuration Files []
[gallery-dl][debug] Starting UrlJob for 'https://pin.it/39YYRhN0f'
[pinterest][debug] Using PinterestPinitExtractor for 'https://pin.it/39YYRhN0f'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): api.pinterest.com:443
[urllib3.connectionpool][debug] https://api.pinterest.com:443 "HEAD /url_shortener/39YYRhN0f/redirect/ HTTP/1.1" 302 0
https://www.pinterest.com/pin/266556871689003952/sent/?invite_code=80139d28e8a34cb38c105de2e84ac671&sender=762164074346835038&sfo=1

i tried the same with -j and the json output is also same

[
  [
    6,
    "https://www.pinterest.com/pin/266556871689003952/sent/?invite_code=80139d28e8a34cb38c105de2e84ac671&sender=762164074346835038&sfo=1",
    {}
  ]
]

unable to get the whole extractor data as you would get normally

mikf commented 1 month ago

Specify -g multiple times or use -G.

$ gallery-dl -g -g https://pin.it/39YYRhN0f
https://i.pinimg.com/originals/a5/6e/12/a56e122ccbc44204a9ecf2c0a9c6f303.jpg
# -gg would work as well

$ gallery-dl -G https://pin.it/39YYRhN0f
https://i.pinimg.com/originals/a5/6e/12/a56e122ccbc44204a9ecf2c0a9c6f303.jpg
abhranil26 commented 1 month ago

works well in cli, but i am using gallery-dl as a module inside my python program to serve as a api, I am running DataJob to get all data output, what should i set in config there? I am aware of UrlJob, but i need to work with Datajob, as i need more than just the media URLs

mikf commented 1 month ago

DataJob now has a resolve argument which resolves intermediary URLs, like -G does compared to -g, and collects their data as well. (https://github.com/mikf/gallery-dl/commit/84a634fc146c2963f62928b3fa46211f44ff82d2)

abhranil26 commented 1 month ago

Thank you @mikf 🙏