Skip to content

Commit

Permalink
Add twitter adapter to prevent errors on 429 status code
Browse files Browse the repository at this point in the history
  • Loading branch information
denniszon committed Jun 29, 2020
1 parent fdf2039 commit 56fc527
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Adapters/Twitter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Embed\Adapters;

use Embed\Http\Response;

/**
* Adapter to provide information from twitter.
* Required when twitter returns a 429 status code.
*/
class Twitter extends Webpage
{
/**
* {@inheritdoc}
*/
public static function check(Response $response)
{
return $response->isValid([200, 429]) && $response->getUrl()->match([
'*twitter.*',
]);
}
}

0 comments on commit 56fc527

Please sign in to comment.