qsniyg / maxurl

Finds larger/original versions of images and videos
https://qsniyg.github.io/maxurl/
Apache License 2.0
1.06k stars 63 forks source link

Python library support #698

Open BradKML opened 3 years ago

BradKML commented 3 years ago

Function: Given an image URL, MaxURL can return another image URL that is larger or "original".

Pre-requisite needs: BeautifulSoup (for light web scraping), Selenium (for JS packed sites), or Requests/urllib (for basic REST architectures)

Assumption: If BeautifulSoup or Request is used, it can't handle Javascript.

qsniyg commented 3 years ago

Though selenium might be required, it actually should be possible to use it with virtually any javascript runtime (such as node.js or other). It's designed to be highly self-sufficient in this manner :) Note however that it cannot perform any requests by itself, so you will need to provide a way for it to do them. If using node.js, an example using request is provided in https://github.com/qsniyg/maxurl/blob/master/reddit-bot/dourl.js (search for do_request).

https://github.com/qsniyg/maxurl/issues/12 might be able to partially help to create a native python library, but it doesn't solve the issue of more complex rules. Perhaps if they were to be written in a retargetable language like Haxe...