blob: 70488464e1c6d713b15852ab1c4c1f6da062cc56 (
plain) (
blame)
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
|
import { download } from "flyscrape/http";
export const config = {
url: "https://commons.wikimedia.org/wiki/London",
};
export default function ({ doc }) {
const symbols = doc.find("#mw-content-text .mw-gallery-traditional:first-of-type li");
return {
symbols: symbols.map(symbol => {
const name = symbol.text().trim();
const url = symbol.find("img").attr("src");
const file = `symbols/${basename(url)}`;
download(url, file);
return { name, url, file };
})
};
}
function basename(path) {
return path.split("/").slice(-1)[0];
}
|