Avatar

@Glench

3 public vals
Joined October 12, 2022
Fork
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { dataToRSS } from "https://esm.town/v/Glench/dataToRSS";
import { fetch } from "https://esm.town/v/std/fetch";
async function getOfficialRedditPosts() {
const resp = await fetch("https://www.reddit.com/r/googlephotos/.json");
if (!resp.ok) return [];
const json = await resp.json();
const filtered_posts = json.data.children.filter(x => {
const title = x.data.title.toLowerCase();
return title.includes("delet") || title.includes("remov") || title.includes("free");
});
return filtered_posts;
}
async function getGoogleSupportForumPosts() {
const resp = await fetch(
"https://support.google.com/photos/threads?hl=en&max_results=500",
);
const text = await resp.text();
// looking for " <a class="thread-list-thread" data-stats-id="247061455" data-stats-ve="87" href="/photos/thread/247061455/how-know-my-photo-record-deleted?hl=en" aria-label=" thread titled How know my photo record deleted FIX_PROBLEM Yas 0 Replies
const [_, ...threads_text] = text.split(/class="thread-list-thread"/);
return threads_text.map(x => {
const id = x.match(/\d+/)[0];
const url = `https://support.google.com${x.split("href=\"")[1].split("\"")[0]}`;
const title = x.split("thread-list-thread__title\">")[1].split("<span")[0].trim() + " (Google Support Forum)";
const selfText = x.split("\"thread-list-thread__snippet\">")[1].split("</span>")[0];
return { data: { created: id, url, title, selfText } };
}).filter(thread_obj => {
const title = thread_obj.data.title.toLowerCase();
return title.includes("delet") && !(
title.includes("recover")
|| title.includes("restor")
|| title.includes("perma")
|| title.includes("trash")
|| title.includes("back")
|| title.includes("deleted")
|| title.includes("mistak")
);
});
}
export const googlePhotosMarketingRSS = async (x) => {
const reddit_posts = await getOfficialRedditPosts();
const google_forum_posts = []; // await getGoogleSupportForumPosts(); // no signal anymore
return new Response(dataToRSS([...reddit_posts, ...google_forum_posts], {
title: "Delete All Google Photos Marketing RSS",
description:
"For marketing Delete All Google Photos Extension. Scrapes r/GooglePhotos and Google's official support forum.",
link: "https://www.reddit.com/r/googlephotos/",
item: {
title: x => x.data.title,
Fork
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { fetch } from "https://esm.town/v/std/fetch";
import { dataToRSS } from "https://esm.town/v/Glench/dataToRSS";
import process from "node:process";
export const tvshows = async function (req, res: express.Response) {
const TV_SHOWS_WATCHED = [
// Ted Lasso
97546,
// Reservation Dogs
95215,
// Survivor
14658,
// Great British Bake-off
87012,
// Wellington Paranormal
80475,
// What We Do in the Sahdows
83631,
// Kotaro Lives Alone
134581,
// Lord of the Rings: Rings of Power
84773,
// Laid-back Camp
76075,
];
const data = [];
for (var i = 0; i < TV_SHOWS_WATCHED.length; ++i) {
const show_id = TV_SHOWS_WATCHED[i];
const url =
`https://api.themoviedb.org/3/tv/${show_id}?api_key=${process.env.tmdb_api_key}`;
const resp = await fetch(url);
const show = await resp.json();
data.push(show);
}
data.sort(function (a, b) {
if (a.last_air_date > b.last_air_date)
return -1;
if (a.last_air_date < b.last_air_date)
return 1;
return 0;
});
res.send(dataToRSS(data, {
title: "My TV Shows",
link: "https://www.val.town/Glench.tvshows",
description: "Personal shows from tmdb api and val.town",
item: {
title: (x) =>
`${x.name} - ${x.last_episode_to_air.name} (${x.last_episode_to_air.season_number}x${x.last_episode_to_air.episode_number})`,
link: (x) => x.last_episode_to_air.id,
description: (x) => x.last_episode_to_air.overview,
Fork
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { wholefoodssales } from "https://esm.town/v/Glench/wholefoodssales";
import { dataToRSS } from "https://esm.town/v/Glench/dataToRSS";
export const wholeFoodsRSS = async function (req, res: express.Response) {
res.send(
dataToRSS(await wholefoodssales(), {
title: "Whole Foods Sales — Personal",
link: "https://wholefoodsmarket.com",
item: {
title: (item) =>
`${item.brand} - ${item.name} - $${
item.incrementalSalePrice || item.salePrice
} ($${item.regularPrice})`,
description: (item) =>
`${item.store === 10091 ? "bellingham" : "dedham"}, ${
item.saleStartDate
}-${item.saleEndDate}`,
link: (item) =>
`https://www.wholefoodsmarket.com/product/${item.slug}?start=${item.saleStartDate}&store=${item.store}`,
pubDate: (item) => item.saleStartDate,
},
})
);
};
/*"regularPrice": 5.69,
"salePrice": 4.19,
"incrementalSalePrice": 3.77,
"saleStartDate": "2023-03-01T00:00:00Z",
"saleEndDate": "2023-04-04T23:59:59Z",
"name": "Fairtrade Baby Hemp Unscented Soap Bar, 5 oz",
"slug": "dr-bronners-fairtrade-baby-hemp-unscented-soap-bar-5-oz-b008588sm6",
"brand": "Dr. Bronner's",
"imageThumbnail": "https://m.media-amazon.com/images/S/assets.wholefoodsmarket.com/PIE/product/6351e34e671f8460db2d6d4b_0018787782057-glamor-front-2022-09-20t17-55-13-iphone-x-quality-90-1-32-2-user-5984ad42a967f880524de2c4-hoqo-666183.jpg",
"store": 10091,
"isLocal": false*/
Next