Comments (5)
I would also appriciate allowing redirects. This guestion on stackoverflow seems to deal the same problem. Suppose open-uri is the cause of the problem.
from pismo.
@peterc I think this has been a problem forever in open-uri. Do you have a recommendation for what to do here? I tried adding this gem that monkey patches open-uri and provides a allow_redirects
option. I tried this out with a New York Times article and it followed their redirect, but hit their paywall, which means the NYT link isn't useful in our app, but it still feels like there should be a built-in way to allow redirects, at least "safe" ones. https://github.com/andyatkinson/pismo/commit/39da3f68380e8260a787562e4f3e21c752a2791d
from pismo.
Hmm, well they must be detecting it somehow, so I'm guessing it's probably through the User-Agent on the request? If so, spoofing that User-Agent with that from a regular browser could work.
Pismo essentially includes open-uri to act as a sort of fallback if you didn't obtain the data in any other way or with a better/proper library, so I don't think going too far in implementing a more powerful HTTP client is a good idea, when they already exist separately (such as Typhoeus or even net/http). That said, spoofing the User-Agent is most likely the quick/cheap fix.
from pismo.
Ok. I'll mess around with the user-agent and try out a separate HTTP library. Thanks for the ideas!
from pismo.
If you find one that's pretty customizable and pure Ruby, let me know as it could become a dependency here. Any native/compiled stuff would be a no-no. Though to be fair, net/http could be used in a more advanced way here I guess..
from pismo.
Related Issues (18)
- segfaults when retrieving keywords from pismo document HOT 7
- getting page links
- Slow Startup/Require HOT 2
- UTF-8 Characters Replaced with ? HOT 3
- Rails + Pismo HOT 1
- Https support
- Pismo doesn't allow redirection to https
- Default reader gets wrong content
- case sensitive matcher and default favicon location.
- Support HTML DEL and INS elements.
- (undefined method `first' for nil:NilClass ) when there is no top_content_candidate
- I18n: work with non english websites
- coder.io
- Image fetch is not working
- Can't match Chinese keywords
- Problem with (CoffeeScript) Code
- pismo fails on many pages with encoding issues HOT 3
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 pismo.