Sleazy Fork is available in English.

議論 » 作成依頼

Autopaging fix for google/yahoo news images

§
投稿日: 2019/07/12

Autopaging fix for google/yahoo news images

Hello,

I have been using an auto-paging extension to load the next pages onto the current page, but for search engine results pages, the next page will load but the images won't. Could anybody come up with a script that will load these images?

Some examples:

https://www.google.com/search?q=food&source=lnms&tbm=nws&sa=X&ved=0ahUKEwigh72nlK7jAhWTKM0KHRQgB68Q_AUIEigD

https://news.search.yahoo.com/search;ylt=AwrE19xD1yddZfAAqQxXNyoA;ylu=X3oDMTE0NXJvcm9wBGNvbG8DYmYxBHBvcwMxBHZ0aWQDQjc2NzZfMQRzZWMDcGl2cw--?p=food&fr2=piv-web&fr=yfp-t

wOxxOmMod
§
投稿日: 2019/07/12
編集日: 2019/07/12

Regarding Google search.

The server response for those subsequent pages simply doesn't have any image on some entries. Those pages have an embedded script to create the images using _setImagesSrc function. To show these images you need to modify the pager extension itself, like it was done in this fork of AP. The original AP also has a similar feature but it runs on the page elements so it can't process the <script> data.

Well, technically speaking it's possible to write a helper userscript but it'll have to re-download each added page and extract the thumbnails from there.

Regarding Yahoo search.

It's possible to write a separate companion script, I didn't test it though.

// ==UserScript==
// @name          Display missing images in yahoo news
// @match         https://news.search.yahoo.com/search*
// ==/UserScript==

run();
document.addEventListener('GM_AutoPagerizeNextPageLoaded', run);

function run() {
  for (const img of document.querySelectorAll('img.s-img[data-src]'))
    img.src = img.dataset.src;
}

返信を投稿

返信を投稿するにはログインしてください。