ask-web-fetch 0.5.6 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ask/web_fetch/backend.rb +16 -0
- data/lib/ask/web_fetch/backends/browser.rb +4 -0
- data/lib/ask/web_fetch/backends/local.rb +12 -0
- data/lib/ask/web_fetch/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '08275e5b901ca9aaba313cac4cd3f776efb2c16b93aa709645c0ad367a1ff720'
|
|
4
|
+
data.tar.gz: 0eaba632b36081a0bc3fbf7dd1ff2b463cadb613e44d8a280d0546aeeda40676
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3c82f4b9abfb154fb06b9a5feaaf2254ddb6caa1cac99892a034311b4113ab1775114ad7c5aa126db88682c3ecf4cdfbee13786b61a06a00f2f30d6b838a2cdf
|
|
7
|
+
data.tar.gz: f3d14810e581699b5d2f8717fa329052ad8b81f03611d637d99fde979f1b324d2939ee79217ee812018327596f07ae0659c987b2e42f197df60af4bff30c8a7b
|
|
@@ -59,6 +59,18 @@ module Ask
|
|
|
59
59
|
# Wikipedia embeds an hcaptcha edit-config flag on every page).
|
|
60
60
|
CHALLENGE_RE = /just a moment|checking your browser|cf-chl/i
|
|
61
61
|
|
|
62
|
+
# Registrar parking-page markers: the page is an ad for a parked
|
|
63
|
+
# (for-sale) domain, not the site's content. A content company must
|
|
64
|
+
# never store these as if they were the site. Observed live on the
|
|
65
|
+
# CC list, three shapes: (a) GoDaddy's parking-lander JS app
|
|
66
|
+
# (ap:"parking" flag, parking-lander asset, LANDER_SYSTEM="PW")
|
|
67
|
+
# served at /lander, (b) Namecheap's parking app (utm_campaign=
|
|
68
|
+
# nc_market + parkingpage links), and (c) static registrar pages
|
|
69
|
+
# ("is parked free, courtesy of GoDaddy.com", "is registered at
|
|
70
|
+
# Namecheap"). Deliberately specific — generic terms like "domain"
|
|
71
|
+
# or "for sale" appear on real pages.
|
|
72
|
+
PARKED_DOMAIN_MARKERS = /ap:"parking"|parking-lander|LANDER_SYSTEM="PW"|utm_campaign=nc_market|utm_source=parkingpage|is parked free, courtesy of GoDaddy|is available on GoDaddy Auctions|is registered at Namecheap/i
|
|
73
|
+
|
|
62
74
|
def self.backend_name
|
|
63
75
|
name.split('::').last
|
|
64
76
|
end
|
|
@@ -118,6 +130,10 @@ module Ask
|
|
|
118
130
|
body.to_s.match?(CHALLENGE_RE)
|
|
119
131
|
end
|
|
120
132
|
|
|
133
|
+
def parked_domain?(body)
|
|
134
|
+
body.to_s.match?(PARKED_DOMAIN_MARKERS)
|
|
135
|
+
end
|
|
136
|
+
|
|
121
137
|
def usable_content?(content)
|
|
122
138
|
content.to_s.strip.length >= MIN_CONTENT_LENGTH
|
|
123
139
|
end
|
|
@@ -199,6 +199,10 @@ module Ask
|
|
|
199
199
|
|
|
200
200
|
return fetch_attempt(page, url, warmed: true)
|
|
201
201
|
end
|
|
202
|
+
# Browser renders the parked page a JS redirect lands on (the
|
|
203
|
+
# server shell hands /lander to JS) — Local never sees it. The
|
|
204
|
+
# shared parked-domain detector catches it here.
|
|
205
|
+
raise EmptyContentError, "parked domain at #{url} — registrar parking page, not site content" if parked_domain?(body)
|
|
202
206
|
|
|
203
207
|
result = Markdown.generate(body, base_url: url, filter: self.class.content_filter)
|
|
204
208
|
result[:outlinks] = outlink_urls(body, url)
|
|
@@ -45,6 +45,18 @@ module Ask
|
|
|
45
45
|
|
|
46
46
|
page = to_markdown(body, url)
|
|
47
47
|
page[:redirected] = redirect
|
|
48
|
+
# Parked-domain pages are not content: the domain owner parked it
|
|
49
|
+
# with a registrar and the page is an ad for buying the domain
|
|
50
|
+
# (GoDaddy/Namecheap/Sedo parking). A content company must never
|
|
51
|
+
# store these as if they were the site. Checked BEFORE the
|
|
52
|
+
# content-minimum — a parking page can render as "content" above
|
|
53
|
+
# the minimum (puncta.ai: 395c of Namecheap auction ads), and
|
|
54
|
+
# must still be rejected. Detectable from the server HTML —
|
|
55
|
+
# parked pages are fully server-rendered, so both Local and
|
|
56
|
+
# Browser see the same ad.
|
|
57
|
+
if parked_domain?(body)
|
|
58
|
+
raise EmptyContentError, "parked domain at #{url} — registrar parking page, not site content"
|
|
59
|
+
end
|
|
48
60
|
raise EmptyContentError, "no readable content at #{url}" unless usable_content?(page[:content])
|
|
49
61
|
# The completeness signal: a JS-app shell whose server HTML
|
|
50
62
|
# renders little is a TRUNCATED page, not a complete one — the
|