Qidian AdBlock

Discussion in 'Tech Discussion' started by noisypixy, Aug 1, 2017.

  1. mrttao

    mrttao Well-Known Member

    Joined:
    Aug 23, 2016
    Messages:
    2,722
    Likes Received:
    1,587
    Reading List:
    Link
    To be honest I have not used it in a while. I just hit play on the ad, switch to another tab to do stuff, and come back later to click skip. It works even if you have it out of focus
     
    Last edited: Jun 4, 2018
  2. kay.lenson

    kay.lenson Deus ex machina

    Joined:
    Oct 20, 2015
    Messages:
    226
    Likes Received:
    61
    Reading List:
    Link
    sorry, just tested not working anymore
     
  3. jace1884

    jace1884 Active Member

    Joined:
    Jun 25, 2017
    Messages:
    4
    Likes Received:
    1
    Reading List:
    Link
    Yea, the script no longer works. I believe it needs to be updated.
     
    Tembulon likes this.
  4. kryner

    kryner BYSTANDER BY NATURE

    Joined:
    Nov 14, 2015
    Messages:
    425
    Likes Received:
    399
    Reading List:
    Link
    Script is blocked sadly
     
    Tembulon likes this.
  5. Heiying

    Heiying Active Member

    Joined:
    May 3, 2018
    Messages:
    14
    Likes Received:
    4
    Reading List:
    Link
    Yep the script is no longer working:blobsad:
     
    Tembulon likes this.
  6. noisypixy

    noisypixy Sacatunn que pen, que summum que tun.

    Joined:
    Jun 25, 2016
    Messages:
    716
    Likes Received:
    950
    Reading List:
    Link
    rip
     
    Tembulon likes this.
  7. Auranyte

    Auranyte Well-Known Member

    Joined:
    Oct 22, 2015
    Messages:
    87
    Likes Received:
    96
    Reading List:
    Link
    They seem to have reused whatever code they had for Premium chapters. Premium chapters used to go gray and only show a part of the chapter. Of course they could be silently turning the "bonus chapters" into premium ones.
     
  8. Gramis

    Gramis Active Member

    Joined:
    Oct 2, 2016
    Messages:
    19
    Likes Received:
    22
    Reading List:
    Link
    No work for me either :(
     
  9. I your Father

    I your Father Well-Known Member

    Joined:
    Feb 28, 2016
    Messages:
    278
    Likes Received:
    131
    Reading List:
    Link
    my problem isn't the script not working, it's the fact that i can't watch those f****ng ads no matter how many times i try.
     
  10. mrttao

    mrttao Well-Known Member

    Joined:
    Aug 23, 2016
    Messages:
    2,722
    Likes Received:
    1,587
    Reading List:
    Link
    did you remember to make an adblock exclusion?
     
  11. mitre27

    mitre27 Well-Known Member

    Joined:
    Jul 8, 2016
    Messages:
    613
    Likes Received:
    279
    Reading List:
    Link
    "Update 2018-06-04 18:14 UTC: Apparently this doesn't work anymore (based on the latest posts on this thread as of this moment). RIP. I don't even like CN, so I probably won't fix it unless I get really bored again."

    :(
     
    Tembulon and AliceShiki like this.
  12. Rethorian

    Rethorian Well-Known Member

    Joined:
    May 9, 2017
    Messages:
    81
    Likes Received:
    106
    Reading List:
    Link
    On the subreddit that we're not allowed to link to, there's a script that still seems to be working to skip ads. I'll copy paste it in case anyone wants it:

    It's more work than a greasemonkey script, but you know, it works for me.

    And for reference, I didn't write the script, I don't understand how the script works, and you should remember when you run scripts by people you don't know, you do so at your own risk.
     
    AliceShiki and I your Father like this.
  13. Nicolas

    Nicolas Well-Known Member

    Joined:
    Nov 1, 2015
    Messages:
    412
    Likes Received:
    523
    Reading List:
    Link
    Waiting 10sec for it to work when ads are about 5sec? Well, at least alternative for us with AdBlock
     
  14. AliceShiki

    AliceShiki 『Ms. Tree』『Magical Girl of Love and Justice』

    Joined:
    Apr 27, 2016
    Messages:
    24,647
    Likes Received:
    98,364
    Reading List:
    Link
  15. Rethorian

    Rethorian Well-Known Member

    Joined:
    May 9, 2017
    Messages:
    81
    Likes Received:
    106
    Reading List:
    Link
    Just tried that, all it did was autoplay the ad, and that was only after I disabled my Noscript/Adblocker. I don't think autoplaying an ad counts as an adblock. Also don't want to have to disable Noscript/enable a whole bunch of scripts I probably don't want to.
     
  16. AliceShiki

    AliceShiki 『Ms. Tree』『Magical Girl of Love and Justice』

    Joined:
    Apr 27, 2016
    Messages:
    24,647
    Likes Received:
    98,364
    Reading List:
    Link
    Well, I never tried using it myself, so I just tried sharing an alternative.
     
  17. ekojsalim

    ekojsalim Active Member

    Joined:
    Feb 16, 2017
    Messages:
    8
    Likes Received:
    24
    Reading List:
    Link
    So, I fixed the code but apparently I need 5 posts or more to be able to post a code block or link lol. We just need to explicitly put _csrfToken into the query and somehow it will work (fetch's credentials: include should already do this tho, I'm not sure why just doing that isn't sufficient)
     
  18. ekojsalim

    ekojsalim Active Member

    Joined:
    Feb 16, 2017
    Messages:
    8
    Likes Received:
    24
    Reading List:
    Link
    After spamming for a while,
    Code:
    // ==UserScript==
    // @name        webnovel.com skip video ads
    // @namespace   http://forum.novelupdates.com/
    // @version     5
    // @run-at      document-end
    // @match       http://webnovel.com/book/*
    // @match       https://webnovel.com/book/*
    // @match       http://www.webnovel.com/book/*
    // @match       https://www.webnovel.com/book/*
    // ==/UserScript==
    
    //------------------------------------------------------------------------------
    // This script is released to the public domain. No attribution is required.
    //------------------------------------------------------------------------------
    
    // FIX - 5/6/18
    // I'm not sure why we need to explicitly pass _csrfToken here (since we specified credentials: include) but hey it works!
    //
    
    // How frequently this script should check for new chapters.
    //
    // The amount is in milliseconds.
    const INTERVAL_CHAPTER_CHECK = 1000;
    
    // When a token is not ready yet, this is how much time we should wait
    // before trying again.
    //
    // The amount is in milliseconds.
    const INTERVAL_TOKEN_CHECK = 1000;
    
    function getCookie(name) {
      var value = "; " + document.cookie;
      var parts = value.split("; " + name + "=");
      if (parts.length == 2) return parts.pop().split(";").shift();
    }
    
    /**
     * Check for new chapters and try to remove the adwall from them.
     */
    function main() {
      Array.from(
       // Locked chapters.
       document.querySelectorAll('.cha-content._lock')
      ).forEach((lock) => {
       // Remove this class so this chapter won't be processed the next time
       // `main` is called.
       lock.classList.remove('_lock');
    
       // Remove the video.
       const v = lock.closest('.chapter_content').querySelector('.lock-video');
       if (v) {
         v.remove();
       }
    
       // Element with the chapter content.
       const contentElement = lock.querySelector('.cha-words');
    
       contentElement.style.opacity = '0.1';
    
       // Get the ID for the series ("book").
       //
       // Some chapters have the `data-bid` property, but not all of them.
       // That's why it's better to just get this from the URL.
       const bid = window.location.href.split('/book/')[1].split('/')[0];
    
       // Get the ID for the chapter.
       const { cid } = lock.querySelector('[data-cid]').dataset;
    
       // Both ID are required.
       if (!bid || !cid) {
         return;
       }
       return fetch(
         `https://www.webnovel.com/apiajax/chapter/GetChapterContentToken?bookId=${bid}&chapterId=${cid}&_csrfToken=${getCookie("_csrfToken")}`
       , {credentials: "include"})
         .then(resp => resp.json())
         .then(data => {
         console.log(data);
         return data.data.token
       })
         .then(token => encodeURIComponent(token))
         .then(token => new Promise((resolve) => {
           // The raw body of the chapter.
           //
           // It will be plain text, so we must manually build the HTML for it.
           let content = '';
    
           // Try to get the content of the chapter, and fulfill the promise once
           // we have it.
           //
           // This function will retry until it succeeds.
           function tick() {
             const url = `https://www.webnovel.com/apiajax/chapter/GetChapterContentByToken?token=${token}&_csrfToken=${getCookie("_csrfToken")}`;
    
             fetch(url, {credentials: "include"})
               .then(resp => resp.json())
               .then((data) => {
                 content = data.data.content.trim();
    
                 if (content) {
                   resolve(content);
                 } else {
                   setTimeout(tick, INTERVAL_TOKEN_CHECK);
                 }
               })
               .catch((err) => {
                 console.error(err.stack);
    
                 tick();
               });
           }
    
           tick();
         }))
         .then((content) => {
           // Build the HTML for the chapter content.
           //
           // For now we only split on line breaks and wrap each piece
           // with "<p></p>" tags.
           const chapterHtml = content
             .split('\n')
             .map(p => p.trim())
             .filter(p => !!p)
             .map(p => `<p>${p}</p>`)
             .join('');
    
           // Update the chapter content and turn opacity back to 100%.
           contentElement.innerHTML = chapterHtml;
           contentElement.style.opacity = '1';
         })
         .catch((err) => {
           console.error(err);
         });
      });
    }
    
    // Since Qidian may load new chapters without refreshing the page, we must
    // continuously check for new chapters in the page.
    setInterval(main, INTERVAL_CHAPTER_CHECK);
    
     
    Cite, Rheklr, Wishez and 17 others like this.
  19. NoAnimeNoLife

    NoAnimeNoLife Active Member

    Joined:
    Dec 31, 2016
    Messages:
    4
    Likes Received:
    1
    Reading List:
    Link
    Fixed code works like a charm, god bless you XD
     
    Tembulon likes this.
  20. Miothan

    Miothan New Member

    Joined:
    Jun 5, 2018
    Messages:
    3
    Likes Received:
    0
    Reading List:
    Link
    Any way to make it work with NoScript? it works when allowing webnovel and yueimg but that is two scripts i do not want to allow.

    Thanks for updating it tho, appreciate it ^_^