greshny-attic / diffbot Goto Github PK
View Code? Open in Web Editor NEWThe ruby Diffbot API client
Home Page: http://www.diffbot.com/docs
License: MIT License
The ruby Diffbot API client
Home Page: http://www.diffbot.com/docs
License: MIT License
Fetching page: http://www.lefigaro.fr/conso/2014/03/07/05007-20140307ARTFIG00092-le-titre-restaurant-enfin-pret-a-passer-a-la-carte.php
an exception is raised:
hashie/trash.rb:72:in `property_exists?': The property 'nextPages' is not defined for this Trash. (NoMethodError)
Sample code causing exception:
Diffbot::Article.fetch(url)
Quick fix for that is:
Diffbot::Article.property :next_pages, from: :nextPages
Hi there, we're not able to upgrade to Hashie 3.5.1 (which improves compatibility with Ruby 2.4) because of the following issue:
/bundler/runtime.rb:94:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'diffbot'.
Gem Load Error is: uninitialized constant Hashie::Extensions::Coercion::RubyVersion
Did you mean? RUBY_VERSION
Using Hashie 3.4.6 is fine though. Any idea how to fix the problem? Is the diffbot gem compatible with ruby 2.4? Thanks!
Diffbot::Article.fetch(@url,diffbot_token)
Above code works fine with Hashie versions till 2.1.2. However refuses to play with Hashie version 3.0.0 onwards instead raising following error -
/usr/local/rvm/gems/ruby-2.1.2@global/gems/hashie-3.0.0/lib/hashie/trash.rb:80:in `property_exists?': The property 'tags' is not defined for this Trash. (NoMethodError) from /usr/local/rvm/gems/ruby-2.1.2@global/gems/hashie-3.0.0/lib/hashie/trash.rb:49:in `[]=' from /usr/local/rvm/gems/ruby-2.1.2@global/gems/diffbot-0.1.7/lib/diffbot/coercible_hash.rb:58:in `[]=' from /usr/local/rvm/gems/ruby-2.1.2@global/gems/hashie-3.0.0/lib/hashie/dash.rb:149:in `block in initialize_attributes' from /usr/local/rvm/gems/ruby-2.1.2@global/gems/hashie-3.0.0/lib/hashie/dash.rb:148:in `each_pair' from /usr/local/rvm/gems/ruby-2.1.2@global/gems/hashie-3.0.0/lib/hashie/dash.rb:148:in `initialize_attributes' from /usr/local/rvm/gems/ruby-2.1.2@global/gems/hashie-3.0.0/lib/hashie/trash.rb:96:in `initialize_attributes' from /usr/local/rvm/gems/ruby-2.1.2@global/gems/hashie-3.0.0/lib/hashie/dash.rb:93:in `initialize' from /usr/local/rvm/gems/ruby-2.1.2@global/gems/diffbot-0.1.7/lib/diffbot/article.rb:41:in `new' from /usr/local/rvm/gems/ruby-2.1.2@global/gems/diffbot-0.1.7/lib/diffbot/article.rb:41:in `fetch' from listbot.rb:9:in `initialize'
Hi,
I'm currently trying to make your gem working.
By following your documentation, I do :
require 'diffbot'
Diffbot::Article.fetch(url, ENV['DIFFBOT_API']) do |request|
request.html = true # Return HTML instead of plain text.
request.summary = true # Return a summary text instead of the full text.
end
That returns :
NoMethodError:
The property 'nextPage' is not defined for Diffbot::Article.
Maybe the Diffbot API changed since issue #1 and its fix ?
Regards
Diffbot has a "global index" API in beta where you can search for news by keyword: https://www.diffbot.com/dev/docs/global-index/
Am I correct in assuming it's not covered in the gem at this time? The interesting thing is that I did see Diffbot::Search return a result. I'm just not sure if there's a method that will execute the search.
> x = Diffbot::Search.new(ENV['DIFFBOT_TOKEN'])
=> #<Search:0x00007fcde2a51ad8 @current_user="my_token_is_shown_here", @query=nil, @sections=[], @params={}, @options={}>
> x.query = 'Apple Inc'
=> "Apple Inc"
> x # note that @query is now set below
=> #<Search:0x00007fcde2a51ad8 @current_user="my_token_is_shown_here", @query="Apple Inc", @sections=[], @params={}, @options={}>
> x.methods.sort
=> [:!, :!=, :!~, :<=>, :==, :===, :=~, :__binding__, :__id__, :__send__, :`, :acts_like?, :admin?, :articles, :as_json, :blank?, :bullet_key, :byebug, :categories, :class, :class_eval, :clone, :companies, :current_user, :current_user=, :customers, :dclone, :debugger, :deep_dup, :define_singleton_method, :display, :dup, :duplicable?, :enum_for, :eql?, :equal?, :extend, :freeze, :friendly_id?, :frozen?, :gem, :hash, :html_safe?, :in?, :inspect, :instance_eval, :instance_exec, :instance_of?, :instance_values, :instance_variable_defined?, :instance_variable_get, :instance_variable_names, :instance_variable_set, :instance_variables, :is_a?, :is_haml?, :itself, :kind_of?, :load_dependency, :mappings, :method, :methods, :nil?, :object_id, :options, :options=, :params, :params=, :presence, :presence_in, :present?, :pretty_inspect, :pretty_print, :pretty_print_cycle, :pretty_print_inspect, :pretty_print_instance_variables, :primary_key_value, :private_methods, :protected_methods, :pry, :psych_to_yaml, :public_method, :public_methods, :public_send, :query, :query=, :remove_instance_variable, :require_dependency, :require_or_load, :respond_to?, :results, :section, :section=, :sections, :sections=, :send, :singleton_class, :singleton_method, :singleton_methods, :solr_search?, :suppress_warnings, :taint, :tainted?, :tap, :to_enum, :to_json, :to_param, :to_query, :to_ruby, :to_s, :to_v8, :to_yaml, :to_yaml_properties, :trust, :try, :try!, :unfriendly_id?, :unloadable, :untaint, :untrust, :untrusted?, :users, :vendor_consultants, :vendor_products, :vendors, :with_options]
I am trying to fetch a product from "Walmart" but i am getting the following error -
NoMethodError: The property 'leafPage' is not defined for Diffbot::Product.
human_language for example is changed under objects. It's not compatible with the new v3 api endpoint.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.