lnreader-plugins icon indicating copy to clipboard operation
lnreader-plugins copied to clipboard

Comrade Mao: Chinese Downloaded instead of english

Open Saylux opened this issue 1 year ago • 3 comments

Source information

Comrade Mao

Steps to reproduce

  1. open any novel in the source
  2. open a chapter or download it
  3. See that Chinese is shown instead of english

Expected behavior

English should be shown or downloaded for each chapter just like in the browser on a laptop or chrome browser on the phone. It defaults to chinese and then after a slight delay switches to english. It even does this in web view.

Actual behavior

Chinese is displayed or downloaded.

LNReader version

1.1.18

Android version

Android 14

Other details

Location of Code: https://github.com/LNReader/lnreader/blob/main/src/sources/en/comrademao.js#L130 I believe that the title needs to be specified for cheerio to choose the right one, as the order of the two anchored links/hrefs may have changed if this was working before.

<div class="gtranslate_wrapper gt_container-ybbqnh" id="gt-wrapper-41514103">
<!-- GTranslate: https://gtranslate.com -->
<a href="#" title="Chinese (Simplified)" data-gt-lang="zh-CN" class="glink nturl notranslate gt-current-lang">
<img loading="lazy" src="/wp-content/plugins/gtranslate/flags/svg/zh-CN.svg" width="48" height="48" alt="zh-CN">
<span>ZH-CN</span>
</a> 
<a href="#" title="English" data-gt-lang="en" class="glink nturl notranslate">
<img loading="lazy" src="/wp-content/plugins/gtranslate/flags/svg/en.svg" width="48" height="48" alt="en"> 
<span>EN</span>
</a> 
<div id="google_translate_element2">
<div class="skiptranslate goog-te-gadget" dir="ltr" style="">

Acknowledgements

  • [X] I have searched the existing issues and this is a new ticket, NOT a duplicate or related to another open issue.
  • [X] I have written a short but informative title.
  • [X] I have updated the app to version 1.1.18.
  • [X] If this is an issue with the app itself, I should be opening an issue in the app repository.
  • [X] I will fill out all of the requested information in this form.

Saylux avatar Dec 31 '23 00:12 Saylux

The website loads the english translations as the users scroll the screen (they make Google Translate API calls for that). Mocking that behaviour in the app wouldn't be possible as it scrapes once on initial page load.

rajarsheechatterjee avatar Jan 03 '24 17:01 rajarsheechatterjee

@rajarsheechatterjee couldn't you just add a wait() there for a few seconds or something? And then let it scrape?

There are several stories that only appear there, and letting it download in the background would be fine.

Saylux avatar Jan 10 '24 19:01 Saylux

@rajarsheechatterjee couldn't you just add a wait() there for a few seconds or something? And then let it scrape?

I don't think it's possible as user has to scroll the entire page for it to be completely translated.

rajarsheechatterjee avatar Jan 11 '24 15:01 rajarsheechatterjee