您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
try to take over the world!
// ==UserScript== // @name PageJaune SCRAP // @namespace http://tampermonkey.net/ // @version 0.2 // @description try to take over the world! // @author You // @match https://www.pagesjaunes.fr/*/* // @grant none // ==/UserScript== (function() { function addScript(attribute, text, callback) { var s = document.createElement('script'); for (var attr in attribute) { s.setAttribute(attr, attribute[attr] ? attribute[attr] : null); } s.innerHTML = text; s.onload = callback; document.body.appendChild(s); } addScript({ src: 'https://code.jquery.com/jquery-3.3.1.js', type: 'text/javascript', async: null }); setTimeout(function() { currentCode = 78; const getUrl = (code, page = 1) => `https://www.pagesjaunes.fr/annuaire/chercherlespros?quoiqui=gestion%20locative&ou=${code}&page=${page}`; currentPageLS = localStorage.getItem('SCRAP_PAGE'); currentPage = currentPageLS ? currentPageLS : 1; var countPage = $('#SEL-compteur').text().split('/'); var totalPage = parseInt(countPage[countPage.length - 1].trim()); console.log(totalPage); currentDataLS = JSON.parse(localStorage.getItem('SCRAP_DATA')); if (!currentDataLS) { localStorage.setItem('SCRAP_DATA', JSON.stringify([])); currentDataLS = []; } var dataThisPage = []; $('.results article').each(function() { currentDataLS.push({ code: currentCode, tel1: $(this).find('.bi-contact-numbers').find('strong').eq(0).text().trim(), tel2: $(this).find('.bi-contact-numbers').find('strong').eq(1).text().trim(), address: $(this).find('.adresse').text().trim(), name: $(this).find('a.denomination-links').text().trim(), page: currentPage }); }); localStorage.setItem('SCRAP_DATA', JSON.stringify(currentDataLS)); setTimeout(function() { currentPage++; if (totalPage >= currentPage) { localStorage.setItem('SCRAP_PAGE', currentPage); window.location.href = getUrl(currentCode, currentPage); } }, 100); }, 1000); })();