I've done quite a bit of offline programming in Java, Python, etc. but I'm quite new to web programming and protocols.
I'm creating a script for myself for the website Deviantart that will shuffle my collections (ie. randomly rearrange images (deviations) within each of the collection folders of my Favorites). For reference, this is what the Favorites page of a random deviant looks like, with the collection folders on the left: http://ift.tt/2dC3mts.
Technically Deviantart does offer an API and I could probably accomplish what I want by randomly removing and re-adding deviations to my folders via the API. I've actually attempted that using Neighbordog's Python wrapper for Deviantart's API (http://ift.tt/2cLH9TJ), but unfortunately it's incompatible with Python 3. I tried using autotranslate
from Python's past
package, as described in http://ift.tt/2dC3ol4, but it ran into UnexpectedToken errors trying to translate and I haven't really gone into trying to debug them. If I have to go with this approach, I'll probably just send the requests myself and avoid using a wrapper.
However, I'd like to learn more general web scripting, and websites don't always offer a readily available API. Now, since a user can rearrange deviations within folders themselves by dragging and dropping them, it should be possible to do it programmatically. However I have no idea how I would even get started on something like this.
My question is 3-fold:
- How would I automatically traverse all my collections, some of which may have more than one page?
- How would I find the request I need to send in order to move a deviation (simulating a user's drag&drop)? Ie. how do I determine what signal the user sends the site when they drag&drop an image?
- How would I then actually send that (randomised) request programatically for each of the deviations in the folder?
Aucun commentaire:
Enregistrer un commentaire