Comments (3)
Hi,
It indeed doesn't seem like it is possible to access to dom via query selectors with the shadow-root
tag open. I don't know much about shadowDOM but it might be possible to make it work.
As long as you can query selector something from the console, our scraper will be able to get it so you will be able to use DocSearch!
from docsearch-scraper.
Cannot select the content of shadowDOM through css selector or xpath.
To select shadowDOM content like a css selector, need to extend the css selector, such as using >>
(outdated specification) instead of shdowDOM boundary: gem-book >> gem-book-sidebar >> gem-active-link
๏ผwhen using this selector, replace >>
with shadowRoot, for example:
'body gem-book >> gem-book-sidebar >> gem-active-link >> a[href]'.split('>>').reduce(
(p, c, index, arr) => {
const isLastSelector = index === arr.length - 1;
return p.map((e) => [...e.querySelectorAll(c)].map((ce) => (isLastSelector ? ce : ce.shadowRoot))).flat();
},
[document],
);
This is also an example of use in the browser, if it is selenium
, there should be a similar API
from docsearch-scraper.
Hi, I viewed the source code today, i found only a little update can support ShadowDOM.
Can use custom downloaders to pull all DOM:
# pseudocode
driver.execute_script("return document.documentElement.getInnerHTML();")
Will get result:
<head>...</head>
<body>
<gem-book>
<template shadowroot="open">
... content
</template>
</gem-book>
</body>
Next, we only need to delete the all <template>
tag(don't delete content), may be a regular expression
from docsearch-scraper.
Related Issues (20)
- TypeError: argument of type 'NoneType' is not iterable HOT 2
- concurrency settings HOT 1
- Index updated but results not showing up HOT 4
- Docker image to support ARM64 Platform HOT 7
- Algolia index records reduction after an undefined amount of time HOT 6
- Chrome not reachable HOT 2
- The error message for host unreachable in older versions was significantly better... HOT 4
- Getting ValueError: CONFIG is not a valid JSON HOT 6
- Need help with creating a Docker Compose file HOT 5
- Docker operation error. Procedure HOT 2
- Python error when running own scrapper HOT 1
- Getitng only 1 NB hit while running from docker HOT 3
- Ignore sidebar headings in algolia indexing
- Algolia search breaks after running subsequent scrapes HOT 2
- unable to run the scraper on local url
- DocSearch: 0 records
- Getting Unreachable hosts error when trying to scrape data
- The prompt record is 0 after running the container
- If this project is no longer maintained, please delete this repository HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docsearch-scraper.