User:Pathoschild/Transfer watchlist: Difference between revisions
Appearance
imported>Pathoschild create page |
imported>Pathoschild m update URL |
||
| (One intermediate revision by the same user not shown) | |||
| Line 23: | Line 23: | ||
// fetch page | // fetch page | ||
const data = await $.getJSON(url); | |||
try { | try { | ||
for (let page of data.watchlistraw) | for (let page of data.watchlistraw) | ||
| Line 42: | Line 42: | ||
console.log("---------------------------------------------") | console.log("---------------------------------------------") | ||
console.log(`Done! Found ${pages.length} pages on your watchlist.`); | console.log(`Done! Found ${pages.length} pages on your watchlist.`); | ||
console.log(`See the instructions at https:// | console.log(`See the instructions at https://stardewvalleywiki.com/User:Pathoschild/Transfer_watchlist for the next steps.`); | ||
console.log(); | console.log(); | ||
console.log(pages.join("\n")); | console.log(pages.join("\n")); | ||
Latest revision as of 19:49, 6 March 2021
This page helps you transfer your watchlist from the old wiki (stardewcommunitywiki.com) to this one.
To do that:
- Open a tab on the old wiki and make sure you're logged in.
- Open a JavaScript console (see instructions).
- Run this script in the console:
await (async function() { const limit = 500; // max allowed by MediaWiki const pages = []; let continueFrom = ""; while (true) { console.log(`fetching pages ${pages.length} to ${pages.length + limit} (${continueFrom}…)`); // build URL let url = `https://stardewcommunitywiki.com/mediawiki/api.php?action=query&list=watchlistraw&wrnamespace=*&wrlimit=${limit}&format=json`; if (continueFrom) url += `&wrcontinue=${continueFrom}`; // fetch page const data = await $.getJSON(url); try { for (let page of data.watchlistraw) pages.push(page.title); continueFrom = data.continue?.wrcontinue; if (!continueFrom) break; } catch (error) { console.error("Failed while fetching watchlist page.", { error, data, continueFrom }); break; } } console.log(); console.log("---------------------------------------------") console.log(`Done! Found ${pages.length} pages on your watchlist.`); console.log(`See the instructions at https://stardewvalleywiki.com/User:Pathoschild/Transfer_watchlist for the next steps.`); console.log(); console.log(pages.join("\n")); })();
- Copy the text from the console:
browser instructions Chrome,
EdgeScroll to the bottom of the console window, and click Copy at the end of the text. Firefox Right-click the text, and choose copy object. - Go to Special:EditWatchlist/raw on this wiki.
- Paste into the box and click Update watchlist.