Skip to content

Commit

Permalink
fix(leviatanscans)!: replace with new extension (#463)
Browse files Browse the repository at this point in the history
* feat(madara): make author selector overridable

* fix(leviatanscans): update to new site

* chore: update `Cargo.lock`

* feat(leviatanscans)!: rename to LSComic

* feat(lscomic): update icon
  • Loading branch information
KaBankz authored Sep 14, 2023
1 parent 88cfc25 commit 76abf88
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 96 deletions.
32 changes: 24 additions & 8 deletions src/rust/madara/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed src/rust/madara/sources/leviatanscans/res/Icon.png
Binary file not shown.
27 changes: 0 additions & 27 deletions src/rust/madara/sources/leviatanscans/res/source.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "leviatanscans"
name = "lscomic"
version = "0.1.0"
edition = "2021"
publish = false
Expand Down
Binary file added src/rust/madara/sources/lscomic/res/Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
{
"type": "check",
"name": "Completed"
},
{
"type": "check",
"name": "Upcoming"
}
]
},
Expand All @@ -43,34 +47,64 @@
},
{
"type": "genre",
"name": "Adventure",
"name": "adventure",
"id": "adventure"
},
{
"type": "genre",
"name": "boys",
"id": "boys"
},
{
"type": "genre",
"name": "Chinese",
"id": "chinese"
},
{
"type": "genre",
"name": "Comedy",
"id": "comedy"
},
{
"type": "genre",
"name": "Drama",
"name": "drama",
"id": "drama"
},
{
"type": "genre",
"name": "ecchi",
"id": "ecchi"
},
{
"type": "genre",
"name": "Fantasy",
"id": "fantasy"
},
{
"type": "genre",
"name": "Harem",
"id": "harem"
"name": "fighting",
"id": "fighting"
},
{
"type": "genre",
"name": "fun",
"id": "fun"
},
{
"type": "genre",
"name": "girl",
"id": "girl"
},
{
"type": "genre",
"name": "Historical",
"id": "historical"
},
{
"type": "genre",
"name": "horrow",
"id": "horrow"
},
{
"type": "genre",
"name": "Isekai",
Expand All @@ -81,6 +115,11 @@
"name": "Magic",
"id": "magic"
},
{
"type": "genre",
"name": "manhwa",
"id": "manhwa"
},
{
"type": "genre",
"name": "Martial Arts",
Expand All @@ -101,11 +140,6 @@
"name": "Romance",
"id": "romance"
},
{
"type": "genre",
"name": "Sci-fi",
"id": "sci-fi"
},
{
"type": "genre",
"name": "Seinen",
Expand All @@ -121,26 +155,11 @@
"name": "Shounen",
"id": "shounen"
},
{
"type": "genre",
"name": "Sports",
"id": "sports"
},
{
"type": "genre",
"name": "Supernatural",
"id": "supernatural"
},
{
"type": "genre",
"name": "Time Travel",
"id": "time-travel"
},
{
"type": "genre",
"name": "Urban",
"id": "urban"
},
{
"type": "genre",
"name": "Villainess",
Expand All @@ -150,11 +169,6 @@
"type": "genre",
"name": "Wuxia",
"id": "wuxia"
},
{
"type": "genre",
"name": "Zombies",
"id": "zombies"
}
]
}
Expand Down
18 changes: 18 additions & 0 deletions src/rust/madara/sources/lscomic/res/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"info": {
"id": "en.lscomic",
"lang": "en",
"name": "LSComic",
"version": 1,
"url": "https://lscomic.com",
"nsfw": 0
},
"listings": [
{
"name": "Trending"
},
{
"name": "Popular"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,16 @@ use aidoku::{
MangaPageResult, Page,
};

use madara_template::helper;
use madara_template::template;

fn get_data() -> template::MadaraSiteData {
let lang_code = helper::get_lang_code();
let base_url;
let description_selector;

match lang_code.as_deref() {
Some("es") => {
base_url = String::from("https://es.leviatanscans.com");
description_selector =
String::from("div.summary_content div.post-content div.post-content_item div p");
}

// LeviatanScans english site uses Data URI images for chapters that are
// chopped up into 4 parts, 2 vertically and 2 horizontally.
// There is no way to stitch these images together in Aidoku, so effectively
// the english site is not usable for the foreseeable future.
// Default to English
_ => {
base_url = String::from("https://en.leviatanscans.com");
description_selector =
String::from("div.summary_content div.post-content div.manga-summary span");
}
}

let data: template::MadaraSiteData = template::MadaraSiteData {
base_url,
description_selector,
chapter_selector: String::from("li.wp-manga-chapter.free-chap"),
template::MadaraSiteData {
base_url: String::from("https://lscomic.com"),
description_selector: String::from("div.manga-about p"),
author_selector: String::from("div.manga-authors a"),
alt_ajax: true,
..Default::default()
};
data
}
}

#[get_manga_list]
Expand Down
5 changes: 4 additions & 1 deletion src/rust/madara/template/src/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub struct MadaraSiteData {
pub search_selector: String,
pub image_selector: String,
pub genre_selector: String,
pub author_selector: String,
pub description_selector: String,
pub chapter_selector: String,
pub base_id_selector: String,
Expand Down Expand Up @@ -70,6 +71,8 @@ impl Default for MadaraSiteData {
post_type: String::from("wp-manga"),
// p to select description from
description_selector: String::from("div.description-summary div p"),
// a to select author from
author_selector: String::from("div.author-content a"),
// selector for chapter list
chapter_selector: String::from("li.wp-manga-chapter"),
// a to get the base id from requests to admin-ajax.php
Expand Down Expand Up @@ -335,7 +338,7 @@ pub fn get_manga_details(manga_id: String, data: MadaraSiteData) -> Result<Manga
title = String::from(title.trim());
}
let cover = get_image_url(html.select("div.summary_image img"));
let author = html.select("div.author-content a").text().read();
let author = html.select(&data.author_selector).text().read();
let artist = html.select("div.artist-content a").text().read();
let description = html.select(&data.description_selector).text().read();

Expand Down

0 comments on commit 76abf88

Please sign in to comment.