Skip to content

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

Description

@haluan
No description provided.

Activity

  1. cantino commented on Mar 22, 2015

    @cantino
    Owner

    You can do .images instead of .content.

  2. plcstevens commented on May 20, 2015

    @plcstevens

    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.

  3. polakowski commented on Jan 7, 2016

    @polakowski

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

  4. matheussilvasantos commented on Sep 12, 2019

    @matheussilvasantos

    @haluan, is it solved for you?

  5. ryzalyusoff commented on Nov 4, 2020

    @ryzalyusoff

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions