From 5418072704e112bc00f149ca6023e623027f5d71 Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Mon, 3 Sep 2018 13:57:44 -0700 Subject: [PATCH] don't use twitter bio URL as author URL --- lib/XRay/Formats/Twitter.php | 16 ++-------------- tests/TwitterTest.php | 4 ++-- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/lib/XRay/Formats/Twitter.php b/lib/XRay/Formats/Twitter.php index f27847c..afb0d2c 100644 --- a/lib/XRay/Formats/Twitter.php +++ b/lib/XRay/Formats/Twitter.php @@ -65,7 +65,7 @@ class Twitter extends Format { 'name' => null, 'nickname' => null, 'photo' => null, - 'url' => null + 'url' => null, ] ); $refs = []; @@ -226,19 +226,7 @@ class Twitter extends Format { else $author['name'] = $profile->screen_name; - if($profile->url) { - if(property_exists($profile, 'entities')) { - if($profile->entities->url->urls[0]->expanded_url) - $author['url'] = $profile->entities->url->urls[0]->expanded_url; - else - $author['url'] = $profile->entities->url->urls[0]->url; - } else { - $author['url'] = $profile->url; - } - } - else { - $author['url'] = 'https://twitter.com/' . $profile->screen_name; - } + $author['url'] = 'https://twitter.com/' . $profile->screen_name; $author['photo'] = $profile->profile_image_url_https; diff --git a/tests/TwitterTest.php b/tests/TwitterTest.php index b498f18..ba7492c 100644 --- a/tests/TwitterTest.php +++ b/tests/TwitterTest.php @@ -36,7 +36,7 @@ class TwitterTest extends PHPUnit_Framework_TestCase { $this->assertEquals('entry', $data['data']['type']); $this->assertEquals('aaronpk dev', $data['data']['author']['name']); $this->assertEquals('pkdev', $data['data']['author']['nickname']); - $this->assertEquals('https://aaronparecki.com/', $data['data']['author']['url']); + $this->assertEquals('https://twitter.com/pkdev', $data['data']['author']['url']); $this->assertEquals('Portland, OR', $data['data']['author']['location']); $this->assertEquals('Dev account for testing Twitter things. Follow me here: https://twitter.com/aaronpk', $data['data']['author']['bio']); $this->assertEquals('https://pbs.twimg.com/profile_images/638125135904436224/qd_d94Qn_normal.jpg', $data['data']['author']['photo']); @@ -47,7 +47,7 @@ class TwitterTest extends PHPUnit_Framework_TestCase { $data = $this->parse(['url' => $url, 'body' => $json]); - $this->assertEquals('http://agiletortoise.com', $data['data']['author']['url']); + $this->assertEquals('https://twitter.com/agiletortoise', $data['data']['author']['url']); } public function testBasicTestStuff() {