lib/onebox/engine/twitter_status_onebox.rb in onebox-1.9.28.3 vs lib/onebox/engine/twitter_status_onebox.rb in onebox-1.9.28.4

- old
+ new

@@ -8,13 +8,17 @@ include HTML matches_regexp(/^https?:\/\/(mobile\.|www\.)?twitter\.com\/.+?\/status(es)?\/\d+(\/(video|photo)\/\d?+)?+(\/?\?.*)?\/?$/) always_https + def http_params + { 'User-Agent' => 'DiscourseBot/1.0' } + end + private def get_twitter_data - response = Onebox::Helpers.fetch_response(url) rescue nil + response = Onebox::Helpers.fetch_response(url, nil, nil, http_params) rescue nil html = Nokogiri::HTML(response) twitter_data = {} html.css('meta').each do |m| if m.attribute('property') && m.attribute('property').to_s.match(/^og:/i) m_content = m.attribute('content').to_s.strip