from flask import Flask, request, jsonify
app = Flask(__name__)
# Mock database of BBC Earth content
bbc_earth_content =
"channel1": "https://example.com/bbc-earth-channel1.m3u8",
"program1": "https://example.com/bbc-earth-program1.m3u8"
@app.route('/get_m3u8_link', methods=['GET'])
def get_m3u8_link():
content_id = request.args.get('content_id')
if content_id in bbc_earth_content:
return jsonify("m3u8_link": bbc_earth_content[content_id])
else:
return jsonify("error": "Content not found"), 404
if __name__ == '__main__':
app.run(debug=True)
If you simply enjoy the technical aspect of playing M3U8 files, here is how to do it legally: