Skip to content

ionite34/rolldet

Repository files navigation

rolldet

Build codecov DeepSource

pre-commit.ci status Checked with mypy FOSSA Status

PyPI - Python Version PyPI version

Advanced Rickroll Detection

  • 🚀 Built as an asynchronous API

  • 🔄 Resolves any short URLs

  • 🔍 Uses copyright signature frameworks where possible

  • 🎯 High accuracy and low rate of false positives

Currently supports

Site Method
YouTube Content ID

YouTube and Content ID are respective trademarks of Google LLC.

Getting started

from rolldet import Detector

async def main():
    det = Detector()

    result = await det.find("https://youtu.be/6-HUgzYPm9g")

    print(result)

    if result.is_roll:
        print("Rickroll detected!")
  • Detector.find is a coroutine that returns a DetectionResult
  • The above example result would have the following attribute values
url -> "https://youtu.be/6-HUgzYPm9g"
redirect_url -> "https://www.youtube.com/watch?v=6-HUgzYPm9g"
is_roll -> True
error -> None
song -> "Never Gonna Give You Up"
artist -> "Rick Astley"
  • You can easily convert these results to dict or json strings
  • Note the json conversion will not have None value keys
result.as_dict() ->
{'url': URL('https://youtu.be/6-HUgzYPm9g'), 'redirect_url': URL('https://www.youtube.com/watch?v=Uj1ykZWtPYI'), 'is_roll': True, 'error': None, 'song': 'Never Gonna Give You Up', 'artist': 'Rick Astley'}

result.json() ->
{"url": "https://youtu.be/6-HUgzYPm9g", "redirect_url": "https://www.youtube.com/watch?v=Uj1ykZWtPYI", "is_roll": true, "song": "Never Gonna Give You Up", "artist": "Rick Astley"}

License

The code in this template is released under the MIT License.

FOSSA Status