https://help.openstreetmap.org/ is a better targeted help forum.
Try fetching the map bounds (leafletjs method on the map object or plugin like https://github.com/Leaflet/Leaflet.draw), then extract the region from your planet or country .osm/.o5m/*.pbf file with https://osmcode.org/osmium-tool/manual.html#creating-geograp...