Git Product home page Git Product logo

Comments (11)

flavorjones avatar flavorjones commented on August 19, 2024

Can you please provide a test case that doesn't need network access? Or, if you'd like to discuss more, we can chat about this on the mailing list. Thanks.

from mechanize.

chopmo avatar chopmo commented on August 19, 2024

Hmm..I'm not sure how to do an offline version of this.

In line 12 of the gist above, I call get() to have the HTML loaded from a URL. Is there another way to load it, eg. from a string?

from mechanize.

chopmo avatar chopmo commented on August 19, 2024

Hmm..I'm not sure how to do an offline version of this.

In line 12 of the gist above, I call get() to have the HTML loaded from a URL. Is there another way to load it, eg. from a string?

from mechanize.

flavorjones avatar flavorjones commented on August 19, 2024

Hi! You can declare an inline xml doc like this:

xml = <<EOXML
<root>
  <some xml=true>foo</some>
</root>
EOXML

and then parse it with

Nokogiri::XML(xml)

from mechanize.

flavorjones avatar flavorjones commented on August 19, 2024

But I'm also hoping that you'll take the opportunity to try to narrow the problem down a bit, so that it's clear which <a> tags are found and which are not.

(In my above comment, replace XML with HTML as necessary).

from mechanize.

chopmo avatar chopmo commented on August 19, 2024

Sorry, but I don't really follow. Parsing a string with Nokogiri is not a problem, but I don't see how to do it with Mechanize?

The common pattern is:

agent = Mechanize.new

page = agent.get("http://google.com")

Instead of the second line above, how could I feed a string into the agent?

from mechanize.

flavorjones avatar flavorjones commented on August 19, 2024

You can do this via something like:

Mechanize::Page.new(nil, {'content-type'=>'text/html'}, your_html, 200, Mechanize.new)

from mechanize.

drbrain avatar drbrain commented on August 19, 2024

This appears to be a bug with Accept-Encoding: gzip, the downloaded file is too short

from mechanize.

drbrain avatar drbrain commented on August 19, 2024

Oops, closed inadvertently

from mechanize.

drbrain avatar drbrain commented on August 19, 2024

This is a bug with the server where the gzip content is cut off mid stream.

Firefox downloads this file using deflate, changing this to a feature request for deflate decoding

from mechanize.

drbrain avatar drbrain commented on August 19, 2024

deflate implemented

from mechanize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.