Skip to content

Commit

Permalink
feat: use web.archive.org instead of archive.today
Browse files Browse the repository at this point in the history
  • Loading branch information
everettsouthwick committed Aug 26, 2023
1 parent a66f021 commit 5e80252
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/constants/platforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const platforms = [
{
name: 'The Atlantic',
pattern: /(https?:\/\/([a-zA-Z0-9-]+\.)?theatlantic\.[^?]+)/g,
replacement: (url) => `https://archive.today/newest/${url}`,
replacement: (url) => `https://web.archive.org/${url}`,
embed: {
author: {
name: 'The Atlantic',
Expand All @@ -40,7 +40,7 @@ const platforms = [
{
name: 'Bloomberg',
pattern: /(https?:\/\/([a-zA-Z0-9-]+\.)?bloomberg\.[^?]+)/g,
replacement: (url) => `https://archive.today/newest/${url}`,
replacement: (url) => `https://web.archive.org/${url}`,
embed: {
author: {
name: 'Bloomberg',
Expand All @@ -53,7 +53,7 @@ const platforms = [
{
name: 'The New York Times',
pattern: /(https?:\/\/([a-zA-Z0-9-]+\.)?nytimes\.com(?!\/crosswords|\/badges).+)/g,
replacement: (url) => `https://archive.today/newest/${url}`,
replacement: (url) => `https://web.archive.org/${url}`,
embed: {
author: {
name: 'The New York Times',
Expand All @@ -66,7 +66,7 @@ const platforms = [
{
name: 'Rolling Stone',
pattern: /(https?:\/\/([a-zA-Z0-9-]+\.)?rollingstone\.[^?]+)/g,
replacement: (url) => `https://archive.today/newest/${url}`,
replacement: (url) => `https://web.archive.org/${url}`,
embed: {
author: {
name: 'Rolling Stone',
Expand All @@ -79,7 +79,7 @@ const platforms = [
{
name: 'The Wall Street Journal',
pattern: /(https?:\/\/([a-zA-Z0-9-]+\.)?wsj\.[^?]+)/g,
replacement: (url) => `https://archive.today/newest/${url}`,
replacement: (url) => `https://web.archive.org/${url}`,
embed: {
author: {
name: 'The Wall Street Journal',
Expand All @@ -92,7 +92,7 @@ const platforms = [
{
name: 'The Washington Post',
pattern: /(https?:\/\/([a-zA-Z0-9-]+\.)?washingtonpost\.[^?]+)/g,
replacement: (url) => `https://archive.today/newest/${url}`,
replacement: (url) => `https://web.archive.org/${url}`,
embed: {
author: {
name: 'The Washington Post',
Expand Down
2 changes: 1 addition & 1 deletion src/utils/handleLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const processArchive = async link => {
if (!isValidUrl(link)) return { links: [], embeds: [] };

const strippedLink = stripQueryString(link);
const newUrl = `https://archive.today/newest/${strippedLink}`;
const newUrl = `https://web.archive.org/${strippedLink}`;
try { return { links: [newUrl], embeds: await buildEmbeds({ name: 'Archive' }, strippedLink, newUrl) }; }
catch (error) { console.error('Error building embed for Archive:', error); return { links: [newUrl], embeds: [] }; }
};
Expand Down
2 changes: 1 addition & 1 deletion src/utils/handleLinkResponse.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async function sendAskModeMessage(message, links, embeds) {
}

async function checkForEmbed(message) {
if (message.content.includes('archive.today')) return Promise.resolve(true);
if (message.content.includes('https://web.archive.org/')) return Promise.resolve(true);
const startTime = Date.now();
return new Promise((resolve) => {
const check = setInterval(() => {
Expand Down

0 comments on commit 5e80252

Please sign in to comment.