kupiakos / LapisMirror

Mirrors images from various sites, and exports them to mirrors like imgur. Plugin-based.
MIT License
19 stars 6 forks source link

Add FurAffinity Support #26

Closed kupiakos closed 8 years ago

kupiakos commented 8 years ago

As requested by /r/zootopia.

Example for testing.

Shugabuga commented 8 years ago

I don't know if this would help, but it seems like there are some custom FurAffinity APIs on GitHub here.

kupiakos commented 8 years ago

@Shugabuga Funny you mention that. I've been using this as a reference point for which CSS selectors would be best.

EDIT: I'm mostly done with the architecture of the plugin; I'm putting it all together now.

Shugabuga commented 8 years ago

I don't know if you prefer ID or class for scraping images from CSS selectors, but here's a few noteworthy things I noticed on how FA organizes user-friendly, non-CDN pages:

#submissionImg targets the submission image td .cat [href*='/user/'] targets the username #keywords targets the tags td .cat b targets the post title

Here's a page with those CSS rules getting some styling...

screencapture-sfw-furaffinity-net-view-20808689-1470790832233

...with this code:

#submissionImg {background-color:red} /*image*/
td .cat [href*='/user/'] {background-color:pink} /*username*/
#keywords {background-color:cyan} /*tags*/
td .cat b {background-color:yellow} /*title*/

I hope that helps in the slightest way! :)

kupiakos commented 8 years ago

Thanks! I'm using td.cat a for the author, and td.cat b for the title. I'm also designing support for reverse-lookup from the FA CDN given that it seems to be very prevalent on /r/zootopia.

Shugabuga commented 8 years ago

That would be nice! If not, you can just take the image on the CDN page and the author from the URL using regex kinda like this (pardon my lack of regex skills):

https?://(*\.)?facdn\.net/art/<user>/*

kupiakos commented 8 years ago

@Shugabuga Go ahead and check out commit 00974cb if you'd like.

Shugabuga commented 8 years ago

Will do! Thanks!