Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to captured image when I used Readability::Document.new(source).content? #80

Open
haluan opened this issue Mar 22, 2015 · 5 comments

Comments

@haluan
Copy link

haluan commented Mar 22, 2015

No description provided.

@cantino
Copy link
Owner

cantino commented Mar 22, 2015

You can do .images instead of .content.

@plcstevens
Copy link

If you mean you want the images to be embedded inside the content you can also try setting the option:

{
  tags: YOUR_TAGS + %w(img),
  remove_empty_nodes: false
}

You may need to add src to the list of attributes as well.

@polakowski
Copy link

When importing content from medium.com you need to add "figure" to allowed tags

@matheussilvasantos
Copy link

@haluan, is it solved for you?

@ryzalyusoff
Copy link

ryzalyusoff commented Nov 4, 2020

I have the same problem. Adde img and remove_empty_nodes: false are doing nothing and still the images are still being removed from content.

url = "https://medium.com/better-advice/20-things-most-people-learn-too-late-in-life-23674cdbd75c"
body = open(url).read
rbody = Readability::Document.new(body, :tags => %w[div p img a figure], :attributes => %w[src href figure], :remove_empty_nodes => false).content
rbody.content

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants