mikf / gallery-dl

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

(Site support request) Zedge images #330

Open phanirithvij opened 5 years ago

phanirithvij commented 5 years ago

Great tool. Would be cool if Zedge.net is supported

phanirithvij commented 5 years ago

I tried to figure out their API but they are using Apache Thrift binary format when sending API requests. It's a pain in the a**.

phanirithvij commented 3 years ago

Now they're using json API.

Single Post For a post https://www.zedge.net/wallpaper/{ID} a request to "https://www.zedge.net/api-zedge-web/browse/download/{ID}" (without any additional headers) will give a download URL which also has a content-disposition header for the filename.

Home(Trending) We can just start querying the API with no cursor initially to get the cursors because if the cursor is omitted, it will respond with the very first page.

i.e for the home page https://www.zedge.net/api-zedge-web/browse/trending?section=home-wallpapers&contentType=wallpapers then loop over navigation

Then query for example https://www.zedge.net/api-zedge-web/browse/trending?cursor=1:4lPN9g:0&section=home-wallpapers&contentType=wallpapers cursor id is 1:4lPN9g:0 till 1:4lPN9g@1000:960 and it gives a list of ids which can be used to get the download URLs from the above.

Tags|search There are tags but they are considered search terms so tags and search results are the same.

Any Tag/search like https://www.zedge.net/find/wallpapers/doom https://www.zedge.net/api-zedge-web/browse/search?query=doom&section=search-wallpapers-doom&contentType=wallpapers then check the navigation for further cursors. . the query URL is https://www.zedge.net/api-zedge-web/browse/search?query=doom&cursor={CURSOR_ID}&section=search-wallpapers-doom&contentType=wallpapers