Skip to content

Commit

Permalink
Merge pull request #369 from denniszon/fix/v3.x/twitter
Browse files Browse the repository at this point in the history
Add twitter adapter to prevent errors on 429 status code
  • Loading branch information
oscarotero authored Jun 29, 2020
2 parents fdf2039 + 56fc527 commit c35f948
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 c35f948

Please sign in to comment.