oseparovic / comic_selectors

34 stars 67 forks source link

What is this?

This is the backend selector handling for the PageFlip comic reader app on Android: https://play.google.com/store/apps/details?id=com.printandpixel.pageflip2&hl=en_US

The app uses css selectors to read and pull out comics and navigation links directly from the comic sites to provide them to the user in a mobile friendly universal format with browsing history, bookmarks and accessibility features

Adding comics

Supported sites use the following format:

{
  "url":"http://nedroid.com/",
  "title":"Nedroid",
  "imageUrl":"http://nedroid.com/comics/2009-02-12-beartato-cheerupface.jpg",
  "imageSelector":"div#comic > img",
  "imageIndex":"0",
  "firstSelector":".nav-first a",
  "firstIndex":"0",
  "prevSelector":"div.nav-previous > a",
  "prevIndex":"0",
  "randomSelector":"http://nedroid.com/?randomcomic=1",
  "randomIndex":"-1",
  "nextSelector":"div.nav-next > a",
  "nextIndex":"0",
  "lastSelector":".nav-last a",
  "lastIndex":"0",
  "donateUrl":"https://www.patreon.com/nedroid",
  "nsfw":true
},

Notes:

Testing your work

If you want to see how your added code will work:

  1. go to https://try.jsoup.org/
  2. copy paste the page source code for the comic into the input HTML section
  3. type in your CSS Query at the bottom of the page e.g. "div#comic > img"
  4. you will see an ordered list of results appear below. If you don't see any results, then your selector is invalid or could not find anything on this page.
  5. The number on the left of the result correponds to the index. Use this for the various index entries in the code above e.g "nextIndex". Most of the time you'll find you'll only need to use 0.
  6. Test that your version of the file is proper JSON. You can copy paste the whole content into a website like this to test (you'll see an error message if there's a syntax problem) http://json.parser.online.fr/

Need help?

If you have questions on how to do this, or have questions/suggestions about the app in general, feel free to open an issue on this project :)