Browse Source

include instagram bio in h-card

pull/72/head v1.4.27
Aaron Parecki 6 years ago
parent
commit
2d19db0308
No known key found for this signature in database GPG Key ID: 276C2817346D6056
2 changed files with 20 additions and 0 deletions
  1. +3
    -0
      lib/XRay/Formats/Instagram.php
  2. +17
    -0
      tests/InstagramTest.php

+ 3
- 0
lib/XRay/Formats/Instagram.php View File

@ -209,6 +209,9 @@ class Instagram extends Format {
else else
$author['photo'] = $profile['profile_pic_url']; $author['photo'] = $profile['profile_pic_url'];
if(isset($profile['biography']))
$author['note'] = $profile['biography'];
return $author; return $author;
} }

+ 17
- 0
tests/InstagramTest.php View File

@ -181,4 +181,21 @@ class InstagramTest extends PHPUnit_Framework_TestCase {
], $data['data']); ], $data['data']);
} }
public function testInstagramProfileWithBio() {
$url = 'https://www.instagram.com/pk_spam/';
$response = $this->parse(['url' => $url]);
$body = $response->getContent();
$this->assertEquals(200, $response->getStatusCode());
$data = json_decode($body, true);
$this->assertSame([
'type' => 'card',
'name' => 'pk_spam',
'url' => 'https://aaronparecki.com/',
'photo' => 'https://instagram.fhel2-1.fna.fbcdn.net/vp/f17e1275a70fc32e93cbf434ddc32bcd/5B6CCC7A/t51.2885-19/11906329_960233084022564_1448528159_a.jpg',
'note' => 'My website is https://aaronparecki.com.dev/ and http://aaronpk.micro.blog/about/ and https://tiny.xyz.dev/'
], $data['data']);
}
} }

Loading…
Cancel
Save