Skip to content

Commit

Permalink
Revert "Fix 1stkissmanga get_chapter_list (#480)"
Browse files Browse the repository at this point in the history
This reverts commit 38e9680.
  • Loading branch information
DthRazak committed Oct 15, 2023
1 parent 38e9680 commit b4c1969
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 28 deletions.
3 changes: 1 addition & 2 deletions src/rust/madara/sources/firstkissmanga/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ publish = false
crate-type = ["cdylib"]

[dependencies]
aidoku = { git = "https://github.com/Aidoku/aidoku-rs/", features = ["helpers"] }
base64 = { version = "0.21.4", default-features = false, features = ["alloc"] }
aidoku = { git = "https://github.com/Aidoku/aidoku-rs/" }
madara_template = { path = "../../template" }
2 changes: 1 addition & 1 deletion src/rust/madara/sources/firstkissmanga/res/source.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id": "en.firstkissmanga",
"lang": "en",
"name": "1ST KISS MANGA",
"version": 3,
"version": 4,
"url": "https://1st-kissmanga.net",
"nsfw": 1
},
Expand Down
27 changes: 2 additions & 25 deletions src/rust/madara/sources/firstkissmanga/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
#![no_std]
use aidoku::{
error::Result, prelude::*, std::net::Request, std::net::HttpMethod, std::String, std::Vec,
Chapter, DeepLink, Filter, Listing, Manga, MangaPageResult, Page,
helpers::substring::Substring
error::Result, prelude::*, std::net::Request, std::String, std::Vec, Chapter, DeepLink, Filter,
Listing, Manga, MangaPageResult, Page,
};

use madara_template::template;

extern crate base64;
use base64::{Engine as _, engine::general_purpose};

fn get_data() -> template::MadaraSiteData {
let data: template::MadaraSiteData = template::MadaraSiteData {
base_url: String::from("https://1st-kissmanga.net"),
get_manga_id: get_int_manga_id,
alt_ajax: true,
..Default::default()
};
Expand Down Expand Up @@ -54,21 +49,3 @@ pub fn handle_url(url: String) -> Result<DeepLink> {
fn modify_image_request(request: Request) {
template::modify_image_request(get_data().base_url, request)
}

fn get_int_manga_id(manga_id: String, base_url: String, path: String) -> String {
let url = base_url + "/" + path.as_str() + "/" + manga_id.as_str();
if let Ok(html) = Request::new(url.as_str(), HttpMethod::Get).html() {
// For this web page, the script is encoded in base64
let id_html_encoded = html.select("script#wp-manga-js-extra").attr("src").read();
let id_html_base64 = id_html_encoded
.substring_after("data:text/javascript;base64,").unwrap_or_default();
let id_html_decoded = general_purpose::STANDARD.decode(id_html_base64).unwrap();
let id_html = String::from_utf8(id_html_decoded).unwrap_or_default();

let id = &id_html[id_html.find("manga_id").expect("Could not find manga_id") + 11
..id_html.find("\"}").expect("Could not find end of manga_id")];
String::from(id)
} else {
String::new()
}
}

0 comments on commit b4c1969

Please sign in to comment.