所以,基本上我有一个JSON文件
{"date":"2020-01-25","explanation":"In this Hubble Space Telescope image the bright, spiky stars lie in the foreground toward the heroic northern constellation Perseus and well within our own Milky Way galaxy. In sharp focus beyond is UGC 2885, a giant spiral galaxy about 232 million light-years distant. Some 800,000 light-years across compared to the Milky Way's diameter of 100,000 light-years or so, it has around 1 trillion stars. That's about 10 times as many stars as the Milky Way. Part of a current investigation to understand how galaxies can grow to such enormous sizes, UGC 2885 was also part of astronomer Vera Rubin's pioneering study of the rotation of spiral galaxies. Her work was the first to convincingly demonstrate the dominating presence of dark matter in our universe.","hdurl":"https://apod.nasa.gov/apod/image/2001/RubinsGalaxy_hst2000.jpg","media_type":"image","service_version":"v1","title":"Rubin's Galaxy","url":"https://apod.nasa.gov/apod/image/2001/RubinsGalaxy_hst1024.jpg"}
这是NASA APOD Api。我想获取一个特定的“ hdurl”值并将其设置为批处理中的URL变量:“ https://apod.nasa.gov/apod/image/2001/RubinsGalaxy_hst2000.jpg ”
然后,我希望它从该站点下载图像。
老实说,我不知道该怎么做。任何帮助将不胜感激!
您可以使用2次for循环:
第一个定界符:}
在for
循环中,;
(默认)在第二个for
循环中2nd:
for /f tokens^=4*delims^=^:^} %i in ('type file.json')do for /f tokens^=1delims^=^"^ %I in ('echo/%i%j')do echo/%I && set "_imageURL=%I"
@echo off
for /f tokens^=4*delims^=^:^} %%i in ('type file.json
')do for /f tokens^=1delims^=^"^ %%I in ('echo/%%i%%j')do echo/%%I && set "_imageURL=%%I"
https//apod.nasa.gov/apod/image/2001/RubinsGalaxy_hst2000.jpg
{"date":"2020-01-25","explanation":"In this Hubble Space Telescope image the bright, spiky stars lie in the foreground toward the heroic northern constellation Perseus and well within our own Milky Way galaxy. In sharp focus beyond is UGC 2885, a giant spiral galaxy about 232 million light-years distant. Some 800,000 light-years across compared to the Milky Way's diameter of 100,000 light-years or so, it has around 1 trillion stars. That's about 10 times as many stars as the Milky Way. Part of a current investigation to understand how galaxies can grow to such enormous sizes, UGC 2885 was also part of astronomer Vera Rubin's pioneering study of the rotation of spiral galaxies. Her work was the first to convincingly demonstrate the dominating presence of dark matter in our universe.","hdurl":"https://apod.nasa.gov/apod/image/2001/RubinsGalaxy_hst2000.jpg","media_type":"image","service_version":"v1","title":"Rubin's Galaxy","url":"https://apod.nasa.gov/apod/image/2001/RubinsGalaxy_hst1024.jpg"}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句