
This is an attempt to make the file conversion from one format to another through the python program. This is done using API from Anyconv.
Code: GitHub
Motivation:
Anyconv provides a very simple interface to get the file format conversion from one format to another. But when there are many files to be converted this will start to appear as a big task. And, a person like me who hates to use the mouse cursor will be even more irritated. Sometimes, this helps in creating an easy solution and a little organized as well.
Steps:
In order to avoid the time-consuming task of converting more files at a time started to think to automate this step. Then started using browsing dev tools to get the API call that is happening on the website. Figured out there were only three API calls that were happening in this file conversion process.
The three API calls were Add, Status, and Download.

curl 'https://anyconv.com/api/action/add/633a03ba68f2e7836ad89c6465bc5050/' \
-H 'authority: anyconv.com' \
-H 'pragma: no-cache' \
-H 'cache-control: no-cache' \
-H 'access-control-allow-origin: *' \
-H 'accept: application/json, text/plain, */*' \
-H 'x-xsrf-token: eyJpdiI6Ims2XC9PdkpoQWlOQk1ubmZkZjJPS0pnPT0iLCJ2YWx1ZSI6IjF3SlpEN3hSQ0ZNajdmS1E3Z2xtbnVcL3grMEFIVTJ6QXQ4VDQrQStqdUVMc3ZsdkZcL0xiUlFMaU1VeWgxMVZtdCIsIm1hYyI6IjM2NWFiNTBmZjI0YTI3NGQ1MGUxZjhjMDkyMDgzYWUwZjAwMTQwYmNjMGQ4YmI2OGVkMjRjMWMxNjg2ZDVlMzIifQ==' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundaryhyR3DScWubwxxoId' \
-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36' \
-H 'sec-ch-ua: "Chromium";v="86", "\"Not\\A;Brand";v="99", "Google Chrome";v="86"' \
-H 'origin: https://anyconv.com' \
-H 'sec-fetch-site: same-origin' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-dest: empty' \
-H 'referer: https://anyconv.com/glb-to-obj-converter/' \
-H 'accept-language: en-US,en;q=0.9' \
-H 'cookie: _ga=GA1.2.1234396918.1602581718; _ym_uid=1596117912523737438; _ym_d=1602581723; _gid=GA1.2.165874002.1603748699; _ym_isad=1; _ym_wasSynced=%7B%22time%22%3A1603748704028%2C%22params%22%3A%7B%22eu%22%3A1%7D%2C%22bkParams%22%3A%7B%7D%7D; _ym_hostIndex=0-1%2C1-0; XSRF-TOKEN=eyJpdiI6Ims2XC9PdkpoQWlOQk1ubmZkZjJPS0pnPT0iLCJ2YWx1ZSI6IjF3SlpEN3hSQ0ZNajdmS1E3Z2xtbnVcL3grMEFIVTJ6QXQ4VDQrQStqdUVMc3ZsdkZcL0xiUlFMaU1VeWgxMVZtdCIsIm1hYyI6IjM2NWFiNTBmZjI0YTI3NGQ1MGUxZjhjMDkyMDgzYWUwZjAwMTQwYmNjMGQ4YmI2OGVkMjRjMWMxNjg2ZDVlMzIifQ%3D%3D; anyconvsession=eyJpdiI6Ink4T1hKOHo5amxUajFBdXB4ZTdYdlE9PSIsInZhbHVlIjoiVlg2K1QzdFk3N2JKNGk3cmxSbmtWZ3pvNzErY1ZjczJvZHdOTWhJK1hWVEFJSzdcL3pmNDFoYW1KYnplN1ZhOXoiLCJtYWMiOiIwN2M5MTkxNDNkMGQyZjAwM2JjNTBjNTNjOGYxMDRjNWFlZDY0ZmQ1NGQ2Yzg4NjEyOTBkOWM2Mjk0ZjI1NTU2In0%3D; _gat_UA-135212576-1=1; _ym_visorc_53329336=w' \
--data-binary $'------WebKitFormBoundaryhyR3DScWubwxxoId\r\nContent-Disposition: form-data; name="file"; filename="test.glb"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n------WebKitFormBoundaryhyR3DScWubwxxoId\r\nContent-Disposition: form-data; name="to"\r\n\r\nobj\r\n------WebKitFormBoundaryhyR3DScWubwxxoId--\r\n' \
--compressed
This is the CURL API call when copied from the browser the way showed in the above image.
Repeated the same process and copied all the three APIs and then figured out only a few headers were that were actually needed. Minimum headers that is required is as below:
curl 'https://anyconv.com/api/action/add/1963a3833306d22646ae43bbe5ff8144/' \
-H 'access-control-allow-origin: *' \
-H 'accept: application/json, text/plain, */*' \
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundarymrHPh4BIPwSilBKz' \
-H 'cookie: _ga=GA1.2.1234396918.1602581718; _ym_uid=1596117912523737438; _ym_d=1602581723; XSRF-TOKEN=eyJpdiI6IlNxbDdXXC9BalhFVjdvYWNFQjZnZld3PT0iLCJ2YWx1ZSI6ImdyZkpPOXd6U0s0ZExmN09aWFFUNit4c1lhNmp3QndsYzNJRkNoaWZxeXpMM3h5b0hXZXJnRnhtT2VkdE9neTAiLCJtYWMiOiI5ZTM1ZGUwMzAyNzMzMDNiYjNhMDkxMjVmMWNjNjMxMmJhOTEyZjVlMzg4MDFmMDRlY2E4NmFhNGU4N2Q1N2I5In0%3D; _gid=GA1.2.252471988.1603569339; _ym_wasSynced=%7B%22time%22%3A1603569345626%2C%22params%22%3A%7B%22eu%22%3A1%7D%2C%22bkParams%22%3A%7B%7D%7D; _ym_isad=1; _ym_visorc_53329336=w; anyconvsession=eyJpdiI6IkhzTkt6U0RkVkZxV2FIM08wODhLakE9PSIsInZhbHVlIjoiOCtWMjlNUjhFM0V0MmJPZW5EckM2bkJvdEE2Z3I4dlwvOWhUQTB3M3RyTFNhcURvY1wvSmpOaXNHSmlPMkxJcnZvIiwibWFjIjoiNWE2NTEzNTY1MTNlMTJkZWVjZGYyODE3YjRhNTU0MmRiODYyNzIxZDYzMGQxNTk5ZTc3MjZmYzA3MDhhNTJhNyJ9' \
--data-binary $'------WebKitFormBoundarymrHPh4BIPwSilBKz\r\nContent-Disposition: form-data; name="file"; filename="@Vine.obj"\r\nContent-Type: application/x-tgif\r\n\r\n\r\n------WebKitFormBoundarymrHPh4BIPwSilBKz\r\nContent-Disposition: form-data; name="to"\r\n\r\ndae\r\n------WebKitFormBoundarymrHPh4BIPwSilBKz--\r\n' \
--compressed
I tried to remove the cookie and run the API, it was getting successful, but was failing when I tried to download the converted file. API requires a cookie to be sent along if not it will return fail in the status API call.
Conclusion:
From this, I was able to get the work done in less than 30 mins which would have taken 2 days to patiently convert something close to 150 files. Thanks for reading cheers!!! Enjoy coding!!!