Scans LAN for any connected Roku's and returns available device information.
- Python3.8+
- PIP - should be installed with python, if not here
pip3 install roku-scannerpython3 -m roku_scannerDevice data output in JSON.
python3 -m roku_scanner --jsonPretty print JSON. Can only be used with json flag.
python3 -m roku_scanner --json --prettyIncreasing timeout on discovery search time. Default is 2 secs. It's advised to use a time less than 10 secs.
python3 -m roku_scanner --timeout 5Change search target to target all devices and not only Roku devices. This will result in non roku devices being added to discovery data. As now(1.0.4) only discovery data is returned for non Roku devices.
python3 -m roku_scanner --search-target-allVerbose Logging
python3 -m roku_scanner --verboseExcluding data from output.
python3 -m roku_scanner --exclude device-infoExclusion Options
- device-info
- apps
- active-app
- media-player
Discovering Roku's and fetching their device data.
from roku_scanner.scanner import Scanner
from roku_scanner.roku import Roku
scanner = Scanner()
scanner.discover()
found_devices = scanner.discovered_devices
for device in found_devices:
roku_location = device.get('LOCATION')
roku = Roku(location=roku_location, discovery_data=device)
roku.fetch_data()
detailed_device_data = roku.data
print(detailed_device_data)Getting device data in JSON.
from roku_scanner.scanner import Scanner
from roku_scanner.roku import Roku
scanner = Scanner()
scanner.discover()
found_devices = scanner.discovered_devices
for device in found_devices:
roku_location = device.get('LOCATION')
roku = Roku(location=roku_location, discovery_data=device)
roku.fetch_data()
json_data = roku.as_json()Getting device data as XML.
from roku_scanner.scanner import Scanner
from roku_scanner.roku import Roku
scanner = Scanner()
scanner.discover()
found_devices = scanner.discovered_devices
for device in found_devices:
roku_location = device.get('LOCATION')
roku = Roku(location=roku_location, discovery_data=device)
roku.fetch_data()
xml_data = roku.as_xml()Changes search target for scanner to search for all devices, this will return Roku devices and any other using UPnP
from roku_scanner.scanner import Scanner
scanner = Scanner(search_target='upnp:rootdevice')
scanner.discover()
all_types_of_devices = scanner.discovered_devicespytest tests/Roku-Scanner follows PEP 8 standard.
Roku-Scanner uses SemVer for versioning. For the versions available, see the tags on this repository.
- Christian Cecilia - Initial work
See also the list of contributors who participated in this project.