LNReader / lnreader-plugins

Repository to host source related issues, and requests for LNReader
MIT License
117 stars 66 forks source link

Comrade Mao: Chinese Downloaded instead of english #674

Open Saylux opened 8 months ago

Saylux commented 8 months ago

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

rajarsheechatterjee commented 8 months ago

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.

Saylux commented 8 months ago

@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.

rajarsheechatterjee commented 8 months ago

@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.