FIX: temporary workaround to fetch Twitter OpenGraph data

FIX: temporary workaround to fetch Twitter OpenGraph data

diff --git a/lib/onebox/engine/twitter_status_onebox.rb b/lib/onebox/engine/twitter_status_onebox.rb
index 06627b8..bb0c9ff 100644
--- a/lib/onebox/engine/twitter_status_onebox.rb
+++ b/lib/onebox/engine/twitter_status_onebox.rb
@@ -10,10 +10,14 @@ module Onebox
       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|

GitHub sha: ea8a19bf

1 Like

This commit has been mentioned on Discourse Meta. There might be relevant details there: