Skip to content

Commit

Permalink
fix: update workaround element to div
Browse files Browse the repository at this point in the history
  • Loading branch information
dy-tea committed Dec 2, 2024
1 parent 426aaf4 commit c716621
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ _Royal Road Novel Downloader_
## Usage

```
rr-dl 1.2.4
rr-dl 1.2.5
-----------------------------------------------
Usage: rr-dl [options] [ARGS]
Expand Down
11 changes: 5 additions & 6 deletions src/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn main() {

// Info
fp.application('rr-dl')
fp.version('1.2.4')
fp.version('1.2.5')
fp.description('A cli program for downloading novels from royalroad.com')
fp.skip_executable()

Expand Down Expand Up @@ -286,21 +286,20 @@ fn main() {
mut replace_class := ''
for j, line in resp_chapter.split_into_lines() {
if line.contains('display: none;') {
replace_class = resp_chapter.split_into_lines()[j - 1].find_between('.',
'{')
replace_class = resp_chapter.split_into_lines()[j - 1].find_between('.', '{')
break
}
}

// Remove invisible class if present (safe goto with breaks?)
for {
replace_class_start := chapter_content.index('<p class="${replace_class}">') or {
replace_class_start := chapter_content.index('<div class="${replace_class}">') or {
println(term.bg_yellow('WARNING: Class "' + replace_class + '" not found'))
break
}
replace_class_end := chapter_content.index_after('</p>', replace_class_start)
replace_class_end := chapter_content.index_after('</div>', replace_class_start)
replace_class_str := chapter_content.substr(replace_class_start, replace_class_end)
chapter_content = chapter_content.replace(replace_class_str, '').replace('</p></p>',
chapter_content = chapter_content.replace(replace_class_str, '').replace('</p></div>',
'</p>')
break
}
Expand Down
4 changes: 2 additions & 2 deletions v.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Module {
name: 'rr_dl'
description: 'royal road novel downloader'
version: '1.2.4'
license: 'GPL'
version: '1.2.5'
license: 'GPL-3'
dependencies: []
}

0 comments on commit c716621

Please sign in to comment.