Youtube ID for trailer returns more than 11 characters
ToshY opened this issue · comments
ToshY commented
Problem
Anime returns youtube id with 12 characters instead of 11.
Reproduction
Example 16904 gives yhNzL20gNX0/
instead of yhNzL20gNX0
.
Cause
While the original embed URL (with additional /
) does work, the regex does not take this into account that it should only be 11 characters for the id.
See this line in Media.php
.
Possible fixes
Correct match for id, possible solutions:
- Change regex part
([^\?&\"'>]+)
to([^\?&\"'>]{11})
- Change statement for
$matches[1] ?? null
toempty($matches[1]) === false ? substr($matches[1], 0, 11) : null
ToshY commented
@irfan-dahir I can create a PR for this if you prefer one of the solutions I provided.