Skip to content

Commit

Permalink
Fix imdb scraping
Browse files Browse the repository at this point in the history
  • Loading branch information
leepeuker committed Oct 21, 2024
1 parent 2742f72 commit 1149dbe
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions src/Api/Imdb/ImdbWebScrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class ImdbWebScrapper

private const string USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:111.0) Gecko/20100101 Firefox/111.0';

private const string VOTING_AVERAGE_CLASS_NAME = 'ljxVSS';
private const string VOTING_AVERAGE_CLASS_NAME = 'imUuxf';

private const string VOTING_COUNT_CLASS_NAME = 'kgbSIj';
private const string VOTING_COUNT_CLASS_NAME = 'dwhNqC';

public function __construct(
private readonly Client $httpClient,
Expand Down
46 changes: 23 additions & 23 deletions tests/unit/Api/Imdb/ImdbWebScrapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,63 +27,63 @@ public function provideFindRatingData() : array
{
return [
[
'ljxVSS">7.9</span>
kgbSIj">229.240</div>',
'imUuxf">7.9</span>
dwhNqC">229.240</div>',
ImdbRating::create(7.9, 229240)
],
'returns no rating if current production status is found' => [
'hjAonB">Post-production
ljxVSS">7.9</span>
kgbSIj">229.240</div>',
imUuxf">7.9</span>
dwhNqC">229.240</div>',
null,
],
[
'ljxVSS">7,9</span>
kgbSIj">229,240</div>',
'imUuxf">7,9</span>
dwhNqC">229,240</div>',
ImdbRating::create(7.9, 229240)
],
[
'ljxVSS">7,9</span>
kgbSIj">229240</div>',
'imUuxf">7,9</span>
dwhNqC">229240</div>',
ImdbRating::create(7.9, 229240)
],
[
'ljxVSS">7,9</span>
kgbSIj">1.229,240</div>',
'imUuxf">7,9</span>
dwhNqC">1.229,240</div>',
ImdbRating::create(7.9, 1229240)
],
[
'ljxVSS">7,9</span>
kgbSIj">40</div>',
'imUuxf">7,9</span>
dwhNqC">40</div>',
ImdbRating::create(7.9, 40)
],
[
'ljxVSS">7,9</span>
kgbSIj">40K</div>',
'imUuxf">7,9</span>
dwhNqC">40K</div>',
ImdbRating::create(7.9, 40000)
],
[
'ljxVSS">7,9</span>
kgbSIj">4.1K</div>',
'imUuxf">7,9</span>
dwhNqC">4.1K</div>',
ImdbRating::create(7.9, 4100)
],
[
'ljxVSS">7,9</span>
kgbSIj">14.12K</div>',
'imUuxf">7,9</span>
dwhNqC">14.12K</div>',
ImdbRating::create(7.9, 14120)
],
[
'ljxVSS">7,9</span>
kgbSIj">10M</div>',
'imUuxf">7,9</span>
dwhNqC">10M</div>',
ImdbRating::create(7.9, 10000000)
],
[
'ljxVSS">7,9</span>
kgbSIj">10.1M</div>',
'imUuxf">7,9</span>
dwhNqC">10.1M</div>',
ImdbRating::create(7.9, 10100000)
],
[
'ljxVSS">7,9</span>',
'imUuxf">7,9</span>',
null
],
[
Expand Down

0 comments on commit 1149dbe

Please sign in to comment.