Skip to content

Commit

Permalink
Merge pull request #150 from ChimeraCoder/oembed-status-statuses-update
Browse files Browse the repository at this point in the history
Update URL field returned by OEmbed test

* Twitter has changed the url it returns from the live API
  • Loading branch information
ChimeraCoder committed Jun 4, 2016
2 parents 35b6f74 + 0e566e7 commit 951c04d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion json/statuses/oembed.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"cache_age":"3153600000","url":"https:\/\/twitter.com\/twitter\/statuses\/99530515043983360","height":null,"provider_url":"https:\/\/twitter.com","provider_name":"Twitter","author_name":"Twitter","version":"1.0","author_url":"https:\/\/twitter.com\/twitter","type":"rich","html":"\u003Cblockquote class=\"twitter-tweet\"\u003E\u003Cp lang=\"en\" dir=\"ltr\"\u003ECool! \u201C\u003Ca href=\"https:\/\/twitter.com\/tw1tt3rart\"\u003E@tw1tt3rart\u003C\/a\u003E: \u003Ca href=\"https:\/\/twitter.com\/hashtag\/TWITTERART?src=hash\"\u003E#TWITTERART\u003C\/a\u003E \u2571\u2571\u2571\u2571\u2571\u2571\u2571\u2571 \u2571\u2571\u256D\u2501\u2501\u2501\u2501\u256E\u2571\u2571\u256D\u2501\u2501\u2501\u2501\u256E \u2571\u2571\u2503\u2587\u2506\u2506\u2587\u2503\u2571\u256D\u252B\u24E6\u24D4\u24D4\u24DA\u2503 \u2571\u2571\u2503\u25BD\u25BD\u25BD\u25BD\u2503\u2501\u256F\u2503\u2661\u24D4\u24DD\u24D3\u2503 \u2571\u256D\u252B\u25B3\u25B3\u25B3\u25B3\u2523\u256E\u2571\u2570\u2501\u2501\u2501\u2501\u256F \u2571\u2503\u2503\u2506\u2506\u2506\u2506\u2503\u2503\u2571\u2571\u2571\u2571\u2571\u2571 \u2571\u2517\u252B\u2506\u250F\u2513\u2506\u2523\u251B\u2571\u2571\u2571\u2571\u2571\u201D\u003C\/p\u003E— Twitter (@twitter) \u003Ca href=\"https:\/\/twitter.com\/twitter\/status\/99530515043983360\"\u003EAugust 5, 2011\u003C\/a\u003E\u003C\/blockquote\u003E\n\u003Cscript async src=\"\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"\u003E\u003C\/script\u003E","width":550}
{"url":"https:\/\/twitter.com\/twitter\/status\/99530515043983360","author_name":"Twitter","author_url":"https:\/\/twitter.com\/twitter","html":"\u003Cblockquote class=\"twitter-tweet\"\u003E\u003Cp lang=\"en\" dir=\"ltr\"\u003ECool! “\u003Ca href=\"https:\/\/twitter.com\/tw1tt3rart\"\u003E@tw1tt3rart\u003C\/a\u003E: \u003Ca href=\"https:\/\/twitter.com\/hashtag\/TWITTERART?src=hash\"\u003E#TWITTERART\u003C\/a\u003E ╱╱╱╱╱╱╱╱ ╱╱╭━━━━╮╱╱╭━━━━╮ ╱╱┃▇┆┆▇┃╱╭┫ⓦⓔⓔⓚ┃ ╱╱┃▽▽▽▽┃━╯┃♡ⓔⓝⓓ┃ ╱╭┫△△△△┣╮╱╰━━━━╯ ╱┃┃┆┆┆┆┃┃╱╱╱╱╱╱ ╱┗┫┆┏┓┆┣┛╱╱╱╱╱”\u003C\/p\u003E— Twitter (@twitter) \u003Ca href=\"https:\/\/twitter.com\/twitter\/status\/99530515043983360\"\u003EAugust 5, 2011\u003C\/a\u003E\u003C\/blockquote\u003E\n\u003Cscript async src=\"\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"\u003E\u003C\/script\u003E","width":550,"height":null,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https:\/\/twitter.com","version":"1.0"}1\u2571\u201D\u003C\/p\u003E— Twitter (@twitter) \u003Ca href=\"https:\/\/twitter.com\/twitter\/status\/99530515043983360\"\u003EAugust 5, 2011\u003C\/a\u003E\u003C\/blockquote\u003E\n\u003Cscript async src=\"\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"\u003E\u003C\/script\u003E","width":550}
5 changes: 5 additions & 0 deletions oembed.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,10 @@ func (a TwitterApi) baseUrlV1() string {
if a.baseUrl == BaseUrl {
return BaseUrlV1
}

if a.baseUrl == "" {
return BaseUrlV1
}

return a.baseUrl
}
4 changes: 2 additions & 2 deletions oembed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ func TestOEmbed(t *testing.T) {
}

if !reflect.DeepEqual(o, expectedOEmbed) {
t.Errorf("Actual OEmbed differs expected:\n%+v\n Got: \n%+v\n", expectedOEmbed, o)
t.Errorf("Actual OEmbed differs expected:\n%#v\n Got: \n%#v\n", expectedOEmbed, o)
}
}

var expectedOEmbed anaconda.OEmbed = anaconda.OEmbed{
Cache_age: "3153600000",
Url: "https://twitter.com/twitter/statuses/99530515043983360",
Url: "https://twitter.com/twitter/status/99530515043983360",
Height: 0,
Provider_url: "https://twitter.com",
Provider_name: "Twitter",
Expand Down

0 comments on commit 951c04d

Please sign in to comment.