-
Notifications
You must be signed in to change notification settings - Fork 433
/
index.js
77 lines (64 loc) 路 1.58 KB
/
index.js
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Rename CustomExtractor
// to fit your publication
// (e.g., NYTimesExtractor)
export const BuzzfeedExtractor = {
domain: 'www.buzzfeed.com',
title: {
selectors: [
'h1[id="post-title"]',
// enter title selectors
],
},
author: {
selectors: [
'a[data-action="user/username"]', 'byline__author',
// enter author selectors
],
},
content: {
selectors: [
['.longform_custom_header_media', '#buzz_sub_buzz'],
'#buzz_sub_buzz',
],
defaultCleaner: false,
// Is there anything in the content you selected that needs transformed
// before it's consumable content? E.g., unusual lazy loaded images
transforms: {
h2: 'b',
'div.longform_custom_header_media': ($node) => {
if ($node.has('img') && $node.has('.longform_header_image_source')) {
return 'figure';
}
return null;
},
'figure.longform_custom_header_media .longform_header_image_source':
'figcaption',
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
clean: [
'.instapaper_ignore',
'.suplist_list_hide .buzz_superlist_item .buzz_superlist_number_inline',
'.share-box',
'.print',
],
},
date_published: {
selectors: [
'.buzz-datetime',
// enter author selectors
],
},
lead_image_url: {
selectors: [
['meta[name="og:image"]', 'value'],
],
},
dek: {
selectors: [
],
},
next_page_url: null,
excerpt: null,
};