Comments (5)
That's the nice thing when you've got a rendered page: You may simply remove everything that isn't visible (for jQuery users: $(":not(:visible)").remove()
).
I can't tell by looking at the markup which parts will be hidden, so I'm closing this as I don't see a way to fix it.
from readabilitysax.
Well what about this in onclosetag
? The idea here would be to only allow one image per level in the readable article. I tested this and it works well on NPR articles except it doesn't remove duplicate captions.
if (tagName === 'img') {
// don't double up on showing images
if (this._imgElem) {
elem.parent.isCandidate = false;
// skip the img
return;
}
else this._imgElem = elem.parent;
}
if (this._imgElem === elem) {
this._imgElem = null;
}
from readabilitysax.
This would solve this particular problem, but would raise others: Just think about image galeries. And I've seen websites that wrapped their content in <pre>
tags, with image tags at random locations. I don't want to break these, even though their markup is terrible. But you may argue the same for npr.org.
Besides, isCandidate
only signals that an element is a candidate for being the container of the article ;)
from readabilitysax.
Okay, first, you should use a label for this code. The boolean isn't needed and complicates everything. Besides, you remove all nodes that aren't <img>
s, which isn't such a good idea.
I guess the best variant would be to filter images based on their URLs, in a similar way as links are already handled. When you find some usable rules for comparing URLs, that would be great.
from readabilitysax.
I got rid of that code.
I instead keep track of the largest image within each div and if the div is too low on contentLength simply use that image as the div's children. This is taking care of enlarge divs and the like. I filter out anything with slideshow explicitly. It's working well.
On Aug 24, 2012, at 5:32 AM, Felix BΓΆhm [email protected] wrote:
Okay, first, you should use a label for this code. The boolean isn't needed and complicates everything. Besides, you remove all nodes that aren't
s, which isn't such a good idea.
I guess the best variant would be to filter images based on their URLs, in a similar way as links are already handled. When you find some usable rules for comparing URLs, that would be great.
β
Reply to this email directly or view it on GitHub.
from readabilitysax.
Related Issues (20)
- ReDoS vulnerability in readabilitySAX.js
- Not grabbing images from twitpic. HOT 1
- Misses <img> with height/width added with CSS HOT 2
- Bug in DomAsSax HOT 3
- Add share and nojavascript to unlikelyCandidates HOT 3
- Issue with wikipedia link HOT 3
- Article images need better detection HOT 2
- Weird chars show up HOT 1
- Links to the page root aren't resolved
- There's a problem with the cnn url http://money.cnn.com/2013/01/23/news/economy/mickelson-taxes/index.html HOT 7
- cannot read http://developers.google.com/chrome-develo per-tools/docs/console HOT 1
- Command line client returns error HOT 2
- Handle stream errors HOT 7
- Stucks sometimes on piping stage in the middle of stream HOT 12
- script is sometimes not filtered in my example HOT 5
- readabilitySAX doesn't handle web pages which require cookie HOT 2
- readibilitySAX can be misled by multiple <title> tags
- Take into account text in divs
- Adopt test cases from mozilla/readability
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 readabilitysax.