Support for Knowledge Graph entities on Google search results
This commit is contained in:
parent
116395766e
commit
2c0210bf18
@ -403,6 +403,7 @@ function getIdentifierFromURLImpl(url: URL): string {
|
|||||||
if (url.pathname.includes('/badge_member_list/')) return null;
|
if (url.pathname.includes('/badge_member_list/')) return null;
|
||||||
|
|
||||||
let host = url.hostname;
|
let host = url.hostname;
|
||||||
|
const searchParams = url.searchParams;
|
||||||
if (domainIs(host, 'web.archive.org')) {
|
if (domainIs(host, 'web.archive.org')) {
|
||||||
const match = captureRegex(url.href, /\/web\/\w+\/(.*)/);
|
const match = captureRegex(url.href, /\/web\/\w+\/(.*)/);
|
||||||
if (!match) return null;
|
if (!match) return null;
|
||||||
@ -412,7 +413,7 @@ function getIdentifierFromURLImpl(url: URL): string {
|
|||||||
if (host.startsWith('www.')) host = host.substring(4);
|
if (host.startsWith('www.')) host = host.substring(4);
|
||||||
|
|
||||||
if (domainIs(host, 'facebook.com')) {
|
if (domainIs(host, 'facebook.com')) {
|
||||||
const fbId = url.searchParams.get('id');
|
const fbId = searchParams.get('id');
|
||||||
const p = url.pathname.replace('/pg/', '/');
|
const p = url.pathname.replace('/pg/', '/');
|
||||||
return 'facebook.com/' + (fbId || getPartialPath(p, p.startsWith('/groups/') ? 2 : 1).substring(1));
|
return 'facebook.com/' + (fbId || getPartialPath(p, p.startsWith('/groups/') ? 2 : 1).substring(1));
|
||||||
} else if (domainIs(host, 'reddit.com')) {
|
} else if (domainIs(host, 'reddit.com')) {
|
||||||
@ -447,6 +448,12 @@ function getIdentifierFromURLImpl(url: URL): string {
|
|||||||
const m = captureRegex(host, /([a-zA-Z0-9\-]*)\.blogspot/);
|
const m = captureRegex(host, /([a-zA-Z0-9\-]*)\.blogspot/);
|
||||||
if (m) return m + '.blogspot.com';
|
if (m) return m + '.blogspot.com';
|
||||||
else return null;
|
else return null;
|
||||||
|
} else if(host.includes('google.')){
|
||||||
|
if(url.pathname == '/search' && searchParams.get('stick') && !searchParams.get('tbm') && !searchParams.get('start')){
|
||||||
|
const q = searchParams.get('q');
|
||||||
|
if(q) return 'wikipedia.org/wiki/' + q.replace(/\s/g, '_');
|
||||||
|
}
|
||||||
|
return null;
|
||||||
} else {
|
} else {
|
||||||
if (host.startsWith('m.')) host = host.substr(2);
|
if (host.startsWith('m.')) host = host.substr(2);
|
||||||
return host;
|
return host;
|
||||||
|
Loading…
Reference in New Issue
Block a user